HDU1170
2016-09-28 19:48
120 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1170
除法的输出居然没有考虑整除情况,结果连续wa了三次才发现
除法的输出居然没有考虑整除情况,结果连续wa了三次才发现
#include<iostream> using namespace std; int main() { int t,a,b; char c; scanf("%d",&t); while(t--) { cin>>c>>a>>b; if(c=='+') printf("%d",a+b); if(c=='-') printf("%d",a-b); if(c=='*') printf("%lld",a*b); if(c=='/') { if(a%b==0) printf("%d",a/b); else printf("%.2lf",a*1.0/b); } printf("\n"); } return 0; }
相关文章推荐
- 背包系列练习及总结(hud 2602 && hdu 2844 Coins && hdu 2159 && poj 1170 Shopping Offers && hdu 3092 Least common multiple && poj 1015 Jury Compromise)
- HDU 1170 JAVA
- HDU-1170-Ballon Comes!(细节题)
- HDU1170 Balloon Comes!
- HDU 1170 Balloon Comes!(水~)
- hdu 1170
- hdu 1170 Balloon Comes
- HDU 1170 Balloon Comes!(计算表达式)
- hdu_1170 Balloon Comes!(简单题)
- hdu-1170 Balloon Comes!
- HDU 1170
- Hdu 1001+1170+1032+1108+2942+1009
- hdu-oj 1170 Balloon Comes!
- hdu 1170,太坑了,整除输出整数,getchar()不能忘记
- hdu 1170 Balloon Comes!(模拟)
- 【ACM】hdu_1170_Balloon Comes!_201307261946
- hdu 1170
- HDU-#1062、1064、1170、1197、1720、2104、2629、2734 HDU水题系列(英文题)(四)
- hdu1170 Balloon Comes!(字符串:水题)
- hdu 1170 Balloon Comes!