提交时间:2024-08-20 09:51:11

运行 ID: 168338

#include<cstdio> const int n=10; int a2[5001],b2[5001],t,c[5001],i; int main() { scanf("%d",&t); for(i=1;i<=t;i++)scanf("%d %d",&a2[i],&b2[i]); bool rech=false; for(i=t;i>=1;i--) { c[i]+=(a2[i]+b2[i]); if(i==1&&c[i]>=10)rech=true; c[i-1]+=c[i]/n; c[i]%=n; } bool ch; if(rech)printf("%d",c[0]); for(i=1;i<=t;i++)printf("%d",c[i]); return 0; }