Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
12049 | 李正谦 | 最大最小 | C++ | Accepted | 100 | 0 MS | 252 KB | 316 | 2020-12-26 17:17:18 |
#include<bits/stdc++.h> using namespace std; int main(){ int l,d,x,s,ans1,ans2,t=0,a; cin>>l>>d>>x; for(int i=l;i<=d;i++){ a=i; s=0; while(true){ s+=a%10; a/=10; if(a==0) break; } if(s==x){ t++; if(t==1) ans1=i; ans2=i; } } cout<<ans1<<endl<<ans2; return 0; }