A - Iroha and Haiku (ABC Edition)
简单模拟即可,判断是否存在两个5一个1。
#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, C; cin >> A >> B >> C;
int five = 0;
int seven = 0;
if(A == 5) five++;
else if(A == 7) seven++;
if(B == 5) five++;
else if(B == 7) seven++;
if(C == 5) five++;
else if(C == 7) seven++;
if(five == 2 && seven == 1) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
B - Iroha Loves Strings (ABC Edition)
对字符串排序,然后concatenate即可。排序直接用string库。
#include <bits/stdc++.h>
using namespace std;
int main(){
vector <string> v;
int N, L; cin >> N >> L;
for(int i = 0; i < N; i++){
string s; cin >> s;
v.emplace_back(s);
}
sort(v.begin(), v.end());
string ans;
for(auto& s : v){
ans += s;
}
cout << ans << endl;
return 0;
}