96372024-02-23 16:51:09PallanekPéterFőzet készítéscpp17Forditási hiba
#include <bits/stdc++.h>
using namespace std;

int main(){
    int dp[501][501];
    for (int a=1; a<32; a++){
        for (int b=1; b<32; b++){
            if (__gcd(i,b)==1){
                for (int i=500; i>=a; i--) {
                    for (int j=500; j>=b; j--) {
                        dp[i][j]=max(dp[i][j],dp[i-a][j-b]+1);
                    }
                }
            }
        }
    }
    int t;
    cin >> t;
    for (int i=0; i<=t; i++) {
        int x, y;
        cin >> x >> y;
        cout << dp[x][y] << "\n";
    }
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:8:23: error: 'i' was not declared in this scope
    8 |             if (__gcd(i,b)==1){
      |                       ^
Exited with error status 1