96382024-02-23 16:51:42PallanekPéterFőzet készítéscpp17Wrong answer 0/50172ms6028 KiB
#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(a,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";
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/0166ms4024 KiB
2Wrong answer0/0171ms4108 KiB
3Wrong answer0/3165ms4324 KiB
4Wrong answer0/2166ms4616 KiB
5Wrong answer0/3165ms4712 KiB
6Wrong answer0/2165ms4668 KiB
7Wrong answer0/3168ms4920 KiB
8Wrong answer0/2168ms4952 KiB
9Wrong answer0/3172ms5212 KiB
10Wrong answer0/2171ms5568 KiB
11Wrong answer0/2168ms5620 KiB
12Wrong answer0/2171ms5448 KiB
13Wrong answer0/2170ms5488 KiB
14Wrong answer0/2168ms5444 KiB
15Wrong answer0/2168ms5448 KiB
16Wrong answer0/2170ms5448 KiB
17Wrong answer0/2171ms5700 KiB
18Wrong answer0/2168ms5768 KiB
19Wrong answer0/2170ms6028 KiB
20Wrong answer0/3171ms5876 KiB
21Wrong answer0/3168ms5904 KiB
22Wrong answer0/3168ms5872 KiB
23Wrong answer0/3170ms6024 KiB