| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 20961 | 王循 | 加入数 | C++ | Accepted | 100 | 0 MS | 264 KB | 677 | 2021-06-24 14:08:52 |
#include <bits/stdc++.h> using namespace std; string a,maxn; string c; bool gjd_greater(string a,string b) { //大于 if(a.size()>b.size())return true; else if(a.size()<b.size())return false; else { for(int i=0; i<a.size(); i++) { int a2=a[i]-'0',b2=b[i]-'0',c=a2-b2; if(c>0)return true; else if(c<0)return false; } } return false; } int main() { cin>>a>>c; maxn=a; for(int i=0;i<=a.size();i++) { a.insert(i,c); for(int j=0;j<a.size();j++) { string a1=" "; a1[0]=a[j]; if(i!=j) { a.erase(j,1); if(gjd_greater(a,maxn))maxn=a; a.insert(j,a1); } } a.erase(i,1); } cout<<maxn<<endl; }