L1-056
Thinking:
Here emissions calculated relative to a sequence
of code:
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, string> P;
int main() {
int n, ans = 0;
cin >> n;
vector<P> v;
for(int i = 0; i < n; i++){
string s;
int num;
cin >> s >> num;
v.push_back(P(num, s));
ans += num;
}
ans = int(1.0 * ans / n / 2);
cout << ans << ' ';
for(P & p : v) p.first = abs(p.first - ans);
sort(v.begin(), v.end());
cout << v[0].second;
return 0;
}
L1-057
Thinking:
really I do not want to play the phrase deceptive words
of code:
#include<bits/stdc++.h>
using namespace std;
int main() {
puts("PTA shi3 wo3 jing1 shen2 huan4 fa1 !");
return 0;
}
L1-058
Ideas:
This title Do not use a space to separate them, one by one loop it honestly
Code:
#include<bits/stdc++.h>
using namespace std;
int main() {
string s;
getline(cin, s);
for(int i = 0; i < s.length(); i++){
if(s[i] != '6') { putchar(s[i]); continue; }
for(int j = i; j < s.length(); j++){
if(j + 1 == s.length() || s[j + 1] != '6'){
int len = j - i + 1;
if(len > 9) { cout << 27; i = j; break; }
else if(len > 3) { cout << 9; i = j; break; }
else { cout << s.substr(i, len); i = j; break; }
}
}
}
return 0;
}
L1-059
Thinking:
This is the question a little nausea , analog bar
codes:
#include<bits/stdc++.h>
using namespace std;
bool ok(string & s){
string cmp = "ong";
int x = s.find(','), y = s.find('.');
if(x < 3) return false;
if(s.substr(x - 3, 3) != cmp || s.substr(y - 3, 3) != cmp) return false;
reverse(s.begin(), s.end());
for(int i = 0; i < 3; i++){
int pos = s.find(' ');
s = s.substr(pos + 1);
}
reverse(s.begin(), s.end());
return true;
}
int main() {
int n;
cin >> n;
getchar();
while(n--){
string s;
getline(cin, s);
if(ok(s)) cout << s << " qiao ben zhong.\n";
else cout << "Skipped\n";
}
return 0;
}
L1-060
Ideas:
a large area to reduce the area
of code:
#include<bits/stdc++.h>
using namespace std;
#define s(x, y) ((x) * (y) / 2)
int main() {
int x, y;
cin >> x >> y;
cout << 5000 - s(x, y) - (100 -x) * y - s(100 - x, 100 -y);
return 0;
}