NYOJ 513
发布时间:2020-12-14 02:54:36 所属栏目:大数据 来源:网络整理
导读:#includestdio.hchar 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]!=' ') i++; //a_point=i; while(sb[i]!='.'sb[i]!=' ') j++; // b_point=j; if(ij) { sc[i]=' '; fo
#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]!=' ') i++; //a_point=i; while(sb[i]!='.'&&sb[i]!=' ') j++; // b_point=j; if(i>j) { sc[i]=' '; 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]=' '; 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; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |