提交时间:2024-08-20 21:31:10
运行 ID: 173558
#include<iostream> #include<cstdio> using namespace std; int n,a,b,c,n9,sum,i,j; bool first; int main() { ios::sync_with_stdio(false); cin>>n; first=1; c=0; n9=0; for(i=1;i<=n;i++) { cin>>a>>b; sum=a+b; if(sum<9) { if(c>0||first==0) cout<<c; for(j=1;j<=n9;j++) cout<<9; first=0; n9=0; c=sum; } else if(sum==9) n9++; else { c++; cout<<c; for(j=1;j<=n9;j++) cout<<0; first=0; n9=0;c=sum-10; } } cout<<c; for(j=1;j<=n9;j++) cout<<9; return 0; }