1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include<bits/stdc++.h> int min(int x,int y) { return (x<y)?x:y; } int max(int x,int y) { return (x>y)?x:y; } int main() { double a[9],b[9],m; while(1) { m=0; for(int i=0;i<8;i++) scanf("%lf",&a[i]); if(a[0]==-1)break; for(int i=0;i<=3;i++) { b[i]=ceil(a[i]/a[i+4]); m=max(m,b[i]); } printf("%0.0lf %0.0lf %0.0lf %0.0lf\n",m*a[4]-a[0],m*a[5]-a[1],m*a[6]-a[2],m*a[7]-a[3]); } return 0; } |
this blog is basically meant to share my experience with u all... so enjoy learning and keep commenting....
Friday, 21 August 2015
SPOJ-BYECAKES
Labels:
spoj
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment