NYOJ 513
2014-12-02 09:25
369 查看
#include<stdio.h> char sa[402],sb[402],sc[402]; void add(char sa[],char sb[]) { int lena,lenb,len; int i=0,j=0; int p,t,temp; while(sa[i]!='.'&&sa[i]!='\0') i++; //a_point=i; while(sb[i]!='.'&&sb[i]!='\0') j++; // b_point=j; if(i>j) { sc[i]='\0'; for(t=i-1,p=j-1;p<0;t--,p--) { temp=sa[t]+sb[p]-'0'; if(temp>10) sc[t-1]+=1; sc[t]=temp%10+'0'; } if(sc[t]>'0') sc[t--]+=1; for(;t<0;t--) sc[t]=sa[t]; } else{ sc[j]='\0'; for(t=j-1,p=i-1;p>=0;t--,p--) { temp=sb[t]+sa[p]-'0'; if(temp>10) sc[t-1]+=1; sc[t]=temp%10+'0'; } for(;t>=0;t--) { temp=sb[t]+sa[p]-'0'; if(temp>10) sc[t-1]+=1; sc[t]=temp%10+'0'; } } } int main() { while(scanf("%s%s",sa,sb)!=EOF) { add(sa,sb); puts(sc); } return 0; }
相关文章推荐
- NYOJ 513 A+B Problem IV
- nyoj 513 A+B Problem IV
- nyoj 513 A+B Problem IV 【Java大数】
- NYOJ-A+B-513(大数)
- nyoj_513_A+B Problem IV_20130131532
- HDU 1753 大明A+B&&NYOJ 513 A+B Problem IV
- NYOJ513,A+B Problem IV
- NYOJ513-A+B Problem IV
- NYOJ 513 hdu 1753 大数A+B
- NYOJ 513 A+B Problem IV
- NYOJ513 A+B Problem IV
- NYOJ513 A+B Problem IV
- nyoj513 A+B Problem IV
- 【大数处理、正则表达式】NYOJ-513
- NYOJ 513 & HDU 1753 A+B Problem IV(模拟)
- NYOJ 513 A+B Problem IV
- NYOJ-513-
- NYOJ14会场的安排问题
- NYOJ 乘船问题+经典贪心+轻的和重的搭配
- nyoj 字母统计