POJ 2562
来源:互联网 发布:python cookbook 编辑:程序博客网 时间:2024/05/29 00:32
开始题目意思没有看懂,结合测试数据就知道是水题了,就是求有多少个进位。算是在poj上做的最水的一个吧!!
AC代码:
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(){ int n,m,a,b,sum,c; while(scanf("%d%d",&n,&m) && (n || m)) { sum=0; c=0; while(n > 0 || m >0) { a=n%10+m%10+c; c=0; n/=10; m/=10; if(a >= 10) { c=a/10; sum++; } } if(sum == 0) printf("No carry operation.\n"); else if(sum == 1) printf("%d carry operation.\n",sum); else printf("%d carry operations.\n",sum); } return 0;}
路途中。。。
- POJ 2562
- POJ-2562:Primary Arithmetic
- poj 2562 Primary Arithmetic
- POJ 2562Primary Arithmetic
- poj 2562 Primary Arithmetic
- POJ 2562:Primary Arithmetic
- POJ-2562-Primary Arithmetic
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- COM学习笔记
- asp.net实现类似QQ单一账户登录,在另一个地方登录后在原登录窗口提示下线
- PHP版 汉字转码
- MySQL解压版编码设置
- PCTFREE,PCTUSED
- POJ 2562
- cygwin版本查询
- Java JDK7安装与环境变量配置详细图解
- Linux应用程序桌面图标添加方法
- 在MyEclipse中如何去掉JS或jsp语法错误提示
- 工具类
- 为什么要使用纹理压缩
- mysql的case when用法
- CUSTOMDRAW和OwnerDraw