标签:style blog http io ar color os sp strong
1、110501/10035 Primary Arithmetic (小学生算术)
注意输出格式
#include<stdio.h> #include<string.h> #include<math.h> #include<ctype.h> #include<algorithm> using namespace std; typedef long long lld; lld a,b; int main() { while(scanf("%lld",&a)!=EOF) { scanf("%lld",&b); if(a==0&&b==0) break; int cnt=0; int tot=0; while(a!=0||b!=0) { if(a%10+b%10+cnt>=10) { cnt=1; tot++; } else { cnt=0; } a/=10; b/=10; } if(tot==0)printf("No "); else printf("%d ",tot); if(tot<=1) printf("carry operation.\n"); else printf("carry operations.\n"); } return 0; }
标签:style blog http io ar color os sp strong
原文地址:http://www.cnblogs.com/varcom/p/4130977.html