(HDU)1170 -- Balloon Comes!(气球来了!)
1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 #include <algorithm> 5 6 using namespace std; 7 8 int main() 9 { 10 int t,a,b; 11 char c; 12 scanf("%d",&t); 13 while(t--) 14 { 15 getchar(); 16 c = getchar(); 17 scanf("%d%d",&a,&b); 18 if (c=='+') printf("%d\n",a+b); 19 if (c=='-') printf("%d\n",a-b); 20 if (c=='*') printf("%d\n",a*b); 21 if (c=='/'&&(a%b==0)) printf("%d\n",a/b); 22 if (c=='/'&&(a%b!=0)) printf("%.2lf\n",a*(1.0)/b); 23 } 24 return 0; 25 }