Submission #574511

#TimeUsernameProblemLanguageResultExecution timeMemory
574511LoboPictionary (COCI18_pictionary)C++17
0 / 140
186 ms2084 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; int t; cin >> t; while(t--){ int a, b; cin >> a >> b; int g = gcd(a, b); int l = g+1, i = 0; while(!(g%l)){ if(i&1) l = g/k; if(!(i&1)) l = (g+k-1)/k; i++; } int lol = g/l; int ans = k-lol+1; cout << ans << '\n'; } }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...