A. Another Sanity Check, Why Not?
Idea: FazeCT
First, you have to check if $$$n$$$ is in one of the following 3 ranges: $$$48 \le n \le 57$$$, $$$65 \le n \le 90$$$, $$$97 \le n \le 122$$$.
If no, then output "Lmao".
Else, use char() to output the character associated with the number $$$n$$$.
#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n; cin >> n;
if(n<48 || (n>57 && n<65) || (n>90 && n<97) || n>122) cout << "Lmao" << endl;
else cout << char(n) << endl;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}
B. Seghhhhhhhhh
Idea: Onirique
If the length of the given string s is odd, then the answer is $$$NO$$$, since adding two strings cannot do that. Otherwise, let $$$n$$$ be the length of the string. Let's go through the first half of the string, comparing whether its first and $$$\frac{n}{2} + 1$$$ characters are equal, its second and $$$\frac{n}{2} + 2$$$ characters are equal, and so on. If the characters in any pair are not equal, the answer is $$$NO$$$, otherwise — $$$YES$$$.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for(int tc=0;tc<t;tc++) {
string s;
cin >> s;
bool ok = true;
if (s.length() % 2 == 0) {
for(int i=0;i<s.length()/2;i++)
if (s[i] != s[i + s.length() / 2])
ok = false;
} else
ok = false;
cout << (ok ? "YES" : "NO") << endl;
}
}
D. Just A Game Of Cards
Idea: FazeCT
Big Mink always lose in this game, but he can make his points maximum possible by placing the cards in a non-decreasing order, so that in each pair of cards, the point Big Mink gets is not too differ from the point Smol Mink gets.
In other words, the array should be sorted in a non-decreasing order. Then the total point Big Mink can get is the sum of even-positioned elements in that array.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
int main()
{
int n; cin >> n;
vector<ll> v(n);
for(auto &x:v) cin >> x;
sort(all(v));
ll res=0;
for(int i=0;i<n;i+=2) res+=v[i];
cout << res;
}




