hdu 1170(Balloon Comes!)
#include<stdio.h> #include<math.h> #define zero 1e-10 int main() { int _case; char ys; int a,b,c; double d; while(scanf("%d",&_case)) { while(_case--) { getchar(); scanf("%c %d %d",&ys,&a,&b); if(ys=='+')printf("%d\n",a+b); else if(ys=='-')printf("%d\n",a-b); else if(ys=='*')printf("%d\n",a*b); else if(ys=='/') { d=(double)a/b; c=d; if(sqrt(d-c)>zero)printf("%.2lf\n",d); else printf("%d\n",c); } } } return 0; }