竞赛
考级
法兰西玫瑰
一枚button
CP003075 字符串题解 这道题的解题思路如下: 1. 判断长度; 2. 若长度相等,则比较每个字符。 代码如下: 注:此代码含本人代码风格
Cephas
#include<bits/stdc++.h> using namespace std; int main() { string a,b; cin >> a >> b; if(a.siz< a << endl << b; else if(a.size() > b.size()) cout << b << endl << a; else if(a<b) cout << a << endl << b; else if(a>b) cout << b << endl << a; return 0; }
159****5594
a
book_worm
#include<bits/stdc++.h> using namespace std; int main(){ string a,b; cin>>a>>b; if(a.length()<b.length())cout<<a<<endl<<b; else if(a.length()>b.length())cout<<b<<endl<<a; else if(a.length()==b.length()){ if(a>b)cout<<b<<endl<<a; else if(a<b)cout<<a<<endl<<b; } return 0; }
准
#include <bits/stdc++.h> using namespace std; int main(){ string s1,s2; cin>>s1>>s2; bool pd; if(s1.size()!=s2.size()) pd=s1.size()<s2.size(); else pd=s1<s2; if(pd==true) cout<<s1<<endl<<s2<<endl; else cout<<s2<<endl<<s1<<endl; return 0; }
Voldemort
#include <bits/stdc++.h> using namespace std; int main() { string x,y; cin >> x >> y; if(x.size()<y.size()){ cout<< x <<endl << y; }else if(x.size()>y.size()){ cout << y << endl << x; }else if(x<y){ cout << x << endl << y; }else{ cout << y << endl << x; } }
chanyz希
#include<iostream> #include<cstring> using namespace std; int main(){ string a,b; int lng,p = 0,y,z; cin >> a >> b; if(a.size() > b.size()){ lng = a.size(); } else { lng = b.size(); } if(a.size() > b.size()){ p = 1; } else if(a.size() < b.size()){ p = 2; } else { for(int i = 0;i < lng;i ++){ if(i > a.size()){ y = 0; } else { y = a[i]; } if(i > b.size()){ z = 0; } else { z = b[i]; } if(y > z){ p = 1; break; } else if(z > y){ p = 2; break; } } }
复仇者_THUNDER
#include<iostream> using namespace std; int main() { string str1,str2; cin>>str1>>str2; str1.size()<str2.size() ? cout<<str1<<endl<<str2 : str1.size()>str2.size() ? cout<<str2<<endl<<str1 : str1<str2 ? cout<<str1<<endl<<str2 : cout<<str2<<endl<<str1; return 0; }
小蚂蚁
嫌疑を避ける ~~
亚洲卷王 AK IOI
潜龙暗虎
JMZ詹总
majmDZB
#include <bits/stdc++.h> using namespace std; int main(){ string a,b; cin>>a>>b; if(a.length()<b.length()){ //判断长度 cout<<a<<endl; cout<<b; return 0; }else if(a.length()>b.length()){ cout<<b<<endl; cout<<a; return 0; }else if(a.length()==b.length()){ if(a<b){ //判断ASCLL码表大小 cout<<a<<endl; cout<<b; }else if(b<a){ cout<<b<<endl; cout<<a; } } return 0; }
张高纶
YuQing1919
沃姆
又水一题
闪电九尾狐