Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 26455 Accepted Submission(s): 10055
1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 5 int main(){ 6 char c; 7 int t, a, b; 8 cin >> t; 9 while(t--){ 10 cin >> c >> a >> b; 11 if(c == ‘+‘) 12 cout << (a + b) << endl; 13 else if(c == ‘-‘) 14 cout << (a - b) << endl; 15 else if(c == ‘*‘) 16 cout << (a * b) << endl; 17 else if(c == ‘/‘){ 18 if(a % b == 0) 19 cout << (a / b) << endl; 20 else 21 printf("%.2f\n", (float)a / b); 22 } 23 } 24 return 0; 25 }
原文:http://www.cnblogs.com/qinduanyinghua/p/5777834.html