标签:des style blog java color strong
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1139 Accepted Submission(s): 238
1 #include<algorithm> 2 #include<cstring> 3 #include<string> 4 #include<cstdio> 5 #include<map> 6 #include<queue> 7 #include<iostream> 8 using namespace std; 9 int main() 10 { 11 int i,j,k,t,m,x,y,z,n; 12 while(cin>>m>>x>>y>>z && m+x+y+z) 13 { int sum=0; 14 sum=x+y*5+z*10; 15 n=m; 16 if(sum<m) 17 cout<<"Hat cannot buy tea."<<endl; 18 else 19 { 20 m=sum-m; 21 int z1=m/10; 22 if(z1<z) m=m-z1*10,z=z-z1; 23 else m=m-z*10,z=0; 24 int y1=m/5; 25 if(y1<y) m=m-y1*5,y=y-y1; 26 else m=m-y*5,y=0; 27 int x1=m; 28 if(x1<x) m=m-x1,x=x-x1; 29 else m=m-x,x=0; 30 if(m!=0) 31 printf("Hat cannot buy tea.\n"); 32 else printf("%d YiJiao, %d WuJiao, and %d ShiJiao\n",x,y,z); 33 } 34 } 35 return 0; 36 }
hdoj 1288 Hat's Tea,布布扣,bubuko.com
标签:des style blog java color strong
原文地址:http://www.cnblogs.com/lovychen/p/3836357.html