标签:
Description
Input
Output
Sample Input
Sample Output
Hint
Source
1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 int main() 6 { 7 int n; 8 while(cin>>n) 9 { 10 string s; 11 while(n--) 12 { 13 cin>>s; 14 int i,a=0,b=0,c=0; 15 for(i=0;s[i]!=‘+‘;i++) 16 a=a*10+s[i]-‘0‘; 17 for(i++;s[i]!=‘-‘;i++) 18 b=b*10+s[i]-‘0‘; 19 for(i++;i<s.length();i++) 20 c=c*10+s[i]-‘0‘; 21 cout<<a+b-c<<endl; 22 } 23 } 24 return 0; 25 }
标签:
原文地址:http://www.cnblogs.com/wixy/p/5492997.html