您的位置:首页 > 其它

hdu_1170 Balloon Comes!(简单题)

2014-01-06 21:57 239 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1170

分析: 注意除法时,整除的话就不需要输出小数点后两位了!!

代码:

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cstring>
#include <algorithm>
#include <stdlib.h>
#include <map>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
const double eps = 1e-8;
const double PI = acos(-1.0);

int main()
{
int t,a,b;
char c;
scanf("%d",&t);
while(t--){
cin>>c>>a>>b;

if(c=='+') printf("%d\n",a+b);
else if(c=='-') printf("%d\n",a-b);
else if(c=='*') printf("%d\n",a*b);
else {
if(a%b) printf("%.2f\n",1.0*a/b);
else printf("%d\n",a/b);
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  简单题