////////////////////////////////////////// PROBLEM - A ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { int n, k; cin >> n >> k; char c = 'a'; for (int i = 0, j = 1; i < n; i++, j++) { cout << c; if (j % k == 0) c = 'a'; else c++; } } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; } ////////////////////////////////////////// PROBLEM - B ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { int k, r; cin >> k >> r; for (int i = 1; i <= 10; i++) { int x = i * k; if (x % 10 == r || x % 10 == 0) { cout << i; break; } } } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; } ////////////////////////////////////////// PROBLEM - C ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { int n; string s; cin >> n >> s; int anton = 0; int danik = 0; for (int i = 0; s[i]; i++) { if (s[i] == 'A') anton++; else danik++; } if (anton > danik) cout << "Anton"; else if (anton < danik) cout << "Danik"; else cout << "Friendship"; } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; } ////////////////////////////////////////// PROBLEM - D ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { int n; cin >> n; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; } int score0 = 0, score1 = 0; bool player = 0; for (int i = 1, j = n; i <= j; player = 1 - player) { int mx; if (a[i] >= a[j]) { mx = a[i]; i++; } else { mx = a[j]; j--; } if (player == 0) score0 += mx; else score1 += mx; } cout << score0 << ' ' << score1; } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; } ////////////////////////////////////////// PROBLEM - E ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { string s1, s2; cin >> s1 >> s2; for (int i = 0; s1[i]; i++) { s1[i] = tolower(s1[i]); s2[i] = tolower(s2[i]); } if (s1 == s2) cout << 0; else if (s1 > s2) cout << 1; else cout << -1; } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; } ////////////////////////////////////////// PROBLEM - F ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { int n; cin >> n; int a[n + 1][2]; for (int i = 1; i <= n; i++) { cin >> a[i][0] >> a[i][1]; } int ans = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { if (a[i][0] == a[j][1]) ans++; if (a[i][1] == a[j][0]) ans++; } } cout << ans; } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; } ////////////////////////////////////////// PROBLEM - G ////////////////////////////////////////// #include #define ll long long using namespace std; void solve() { string s1, s2; cin >> s1 >> s2; int i = 0; for (int j = 0; s2[j]; j++) { if (s1[i] == s2[j]) i++; } cout << i + 1; } int main() { int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; }