Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
18329 hhz123 [acwing]找数字 C++ 解答错误 0 MS 252 KB 553 2023-02-19 10:57:09

Tests(1/10):


#include <bits/stdc++.h> using namespace std; int m,s; int a[110],b[110]; int main(){ cin>>m>>s; int s1=s,s2=s; if(s==0&&m>1)cout<<"-1 -1"; else{ for(int i=1;i<=m;i++){ if(s1>9){ a[i]=9; s1-=9; }else { a[i]=s1; } } for(int i=m;i>=1;i--){ b[m-i+1]=a[i]; } if(b[1]==0){ for(int i=1;i<=m;i++){ if(b[i]>0){ b[i]-=1; break; } } b[1]=1; } for(int i=1;i<=m;i++){ cout<<b[i]; } cout<<' '; for(int i=1;i<=m;i++){ cout<<a[i]; } } return 0; }


测评信息: