# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
146658 | 2019-08-25T05:30:28 Z | pichulia | 분수 (KPI13_fractions) | C++11 | 1000 ms | 504 KB |
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { long long int a,b,c,d; long long int k; scanf("%lld %lld %lld %lld",&a,&b,&c,&d); long long int x,y; long long int p,q; k = a/b; y=1; while(1) { p=d+(a*y/b)*d; q=c*y; if(p<q)break; y += (p-q)/(c-k*d)+1; } x = a*y/b+1; printf("%lld %lld\n",x,y); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 128 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Execution timed out | 1067 ms | 256 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |