Submission #473914

#TimeUsernameProblemLanguageResultExecution timeMemory
473914Ahmed57Euklid (COCI20_euklid)C++14
15 / 110
1092 ms35536 KiB
#include <bits/stdc++.h> using namespace std; int dp[3001][3001]; long long r(long long a,long long b){ if(dp[a][b]!=-1)return dp[a][b]; if(a<b)return dp[a][b]= r(b,a); else if(a>=b&&b>1)return dp[a][b]=r(abs(a/b),b); else if(a>=b&&b==1)return dp[a][b]=a; } int main(){ //ios_base::sync_with_stdio(false);cin.tie(NULL); memset(dp,-1,sizeof dp); int t;cin>>t; z:while(t--){ long long a,b; cin>>a>>b; for(int i = 1;i<3000;i++){ for(int j = 1;j<3000;j++){ if(__gcd(i,j)==a&&r(i,j)==b){ cout<<i<<" "<<j<<"\n"; goto z; } } } } return 0; }

Compilation message (stderr)

euklid.cpp: In function 'long long int r(long long int, long long int)':
euklid.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...