We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36b13b6 commit 051d57cCopy full SHA for 051d57c
1144.E. Median String.cpp
@@ -0,0 +1,31 @@
1
+#include "stdc++.h"
2
+
3
+int main() {
4
+ int n;
5
+ string s, t;
6
+ cin >> n >> s >> t;
7
+ reverse(ALL(s));
8
+ reverse(ALL(t));
9
+ for (int i=0; i<s.size(); ++i) {
10
+ s[i] = s[i]-'a' + t[i]-'a';
11
+ if (s[i] > 25) {
12
+ s[i] -= 26;
13
+ if (i+1==s.size())
14
+ s.PB(1);
15
+ else
16
+ ++s[i+1];
17
+ }
18
19
20
+ int c = 0;
21
+ FOR(i, SZ(s)) {
22
+ if (c) {
23
+ s[i] += 26;
24
+ c = 0;
25
26
+ c = s[i] & 1;
27
+ s[i] = (s[i]>>1) + 'a';
28
29
+ cout << s.substr(SZ(s)-n) << endl;
30
+ return 0;
31
+}
0 commit comments