markdown 在线制作ppt json校验和格式化工具

POJ 2562

 1 #include<iostream>
 2 #include<algorithm>
 3 #define MAXN 15
 4 using namespace std;
 5 
 6 //int rec[MAXN];
 7 
 8 int main()
 9 {
10     //freopen("acm.acm","r",stdin);
11     int ans;
12     int x;
13     int y;
14     int dight_x;
15     int dight_y;
16     int i;
17     int rec;
18     while(cin>>x>>y)
19     {
20         if(!x&&!y)
21             break;
22         ans = 0;
23         i = 0;
24         rec = 0;
25         while(y||x)
26         {
27             dight_x = x%10;
28             dight_y = y%10;
29             x /= 10;
30             y /= 10;
31             if(rec + dight_x + dight_y > 9)
32             {
33                 rec = 1;
34                 ++ ans;
35             }
36             else
37                 rec = 0;
38         }
39         if(ans == 0)
40             cout<<"No carry operation."<<endl;
41         else if(ans > 1)
42             cout<<ans<<" carry operations."<<endl;
43         else
44             cout<<ans<<" carry operation."<<endl;
45     }
46 }

 

posted @ 2015-06-11 11:37  GavinHacker  阅读(115)  评论(0编辑  收藏  举报
markdown 在线制作ppt json校验和格式化工具