Submission #473948

#TimeUsernameProblemLanguageResultExecution timeMemory
473948BidoTeimaEuklid (COCI20_euklid)C++17
0 / 110
34 ms63124 KiB
/// isA AC #include <bits/stdc++.h> using namespace std; using ll = long long; void ACPLS() { #ifndef ONLINE_JUDGE freopen("output.txt", "w", stdout); freopen("input.txt", "r", stdin); #endif ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } #define tc \ int tttttt,subtask; \ cin >> tttttt /*>> subtask*/; \ while (tttttt--) #define sumrange(l, r, arr) (l == 0 ? arr[r] : arr[r] - arr[l - 1]) #define all(v) v.begin(), v.end() ll GCDAC(ll a, ll b) { if(b==0) return a; return GCDAC(b, a%b); } ll gcd(ll a, ll b) { if(a<b)swap(a,b); return GCDAC(a, b); } int dp[(int)4005][(int)4005]; int R(int a, int b){ if(dp[a][b]!=-1) return dp[a][b]; if(a<b) return dp[a][b]=R(b,a); if(a>=b&&b>1) return dp[a][b]=R(a/b,b); return dp[a][b]=a; } int main() { ACPLS(); memset(dp,-1,sizeof(dp)); tc{ int g,h; cin>>g>>h; for(int a = 1; a <= g*10; a++){ bool flag=0; for(int b = 1; b <= g*10; b++){ if(gcd(a,b)==g&&R(a,b)==h){ cout<<a<<' '<<b<<'\n'; flag=1; break; } } if(flag)break; } } }

Compilation message (stderr)

euklid.cpp: In function 'int main()':
euklid.cpp:16:16: warning: unused variable 'subtask' [-Wunused-variable]
   16 |     int tttttt,subtask;    \
      |                ^~~~~~~
euklid.cpp:47:1: note: in expansion of macro 'tc'
   47 | tc{
      | ^~
euklid.cpp: In function 'void ACPLS()':
euklid.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
euklid.cpp:9:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...