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

POJ 2572

 1 #include<stdio.h>
 2 #include<iostream>
 3 #include<string>
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     //freopen("acm.acm","r",stdin);
 9     string s;
10     int pos;
11     int pos1;
12     string s1;
13     string s2;
14     string s3;
15     int i;
16     int sum1;
17     int sum2;
18     int sum3;
19     while(cin>>s)
20     {
21         sum1 = 0;
22         sum2 = 0;
23         sum3 = 0;
24         pos = s.find('+');
25         s1.assign(s.begin(),s.begin()+pos);
26         for(i = s1.length()-1; i >= 0; -- i)
27         {
28             sum1 = sum1*10 + s1[i]-'0';
29         }
30         pos1 = s.find('=');
31         s2.assign(s.begin()+pos+1,s.begin()+pos1);
32         for(i = s2.length()-1; i >= 0; -- i)
33         {
34             sum2 = sum2*10 + s2[i]-'0';
35         }
36         s3.assign(s.begin()+pos1+1,s.end());
37         for(i = s3.length()-1; i >= 0; -- i)
38         {
39             sum3 = sum3*10 + s3[i]-'0';
40         }
41         if(sum3 == sum1 + sum2)
42             cout<<"True"<<endl;
43         else
44             cout<<"False"<<endl;
45     }
46 }

 

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