제출 #146658

#제출 시각아이디문제언어결과실행 시간메모리
146658pichulia분수 (KPI13_fractions)C++11
0 / 1
1067 ms504 KiB
#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); } }

컴파일 시 표준 에러 (stderr) 메시지

fractions.cpp: In function 'int main()':
fractions.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&t);
     ~~~~~^~~~~~~~~
fractions.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...