├── Codeforces └── 800 │ ├── 110A.cpp │ ├── 116A.cpp │ ├── 1216A.cpp │ ├── 1328A.cpp │ ├── 1352A.cpp │ ├── 1367A.cpp │ ├── 200B.cpp │ ├── 236A.cpp │ ├── 344A.cpp │ ├── 41A.cpp │ ├── 431A.cpp │ ├── 469A.cpp │ ├── 4A.cpp │ ├── 734A.cpp │ ├── 750A.cpp │ ├── 758A.cpp │ └── a.out └── LeetCode └── leetcode.txt /Codeforces/800/110A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | string n; 7 | cin >> n; 8 | 9 | bool isLucky = true; 10 | for (char c : n) { 11 | if (c != '4' || c != '7') { 12 | isLucky = false; 13 | } 14 | } 15 | 16 | if (isLucky) { 17 | cout << "NO"; 18 | return 0; 19 | } 20 | 21 | int lucky_nums = 0; 22 | for (char c : n) { 23 | if (c == '4' || c == '7') { 24 | lucky_nums++; 25 | //cout << "lucky_nums : " << lucky_nums << "\n"; 26 | } 27 | } 28 | 29 | if (lucky_nums == 4 || lucky_nums == 7) { 30 | cout << "YES"; 31 | } else { 32 | cout << "NO"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Codeforces/800/116A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int num_stops; 6 | cin >> num_stops; 7 | 8 | int current_passengers = 0; 9 | int max_passengers = 0; 10 | for (int i=0; i> exit; 13 | int enter; 14 | cin >> enter; 15 | 16 | current_passengers -= exit; 17 | current_passengers += enter; 18 | 19 | max_passengers = std::max(max_passengers, current_passengers); 20 | } 21 | 22 | cout << max_passengers; 23 | } 24 | -------------------------------------------------------------------------------- /Codeforces/800/1216A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | 9 | string s; 10 | cin >> s; 11 | 12 | string res = ""; 13 | 14 | int min_operations = 0; 15 | for (int i=0; i 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin >> t; 7 | 8 | while (t--) { 9 | int a; 10 | cin >> a; 11 | 12 | int b; 13 | cin >> b; 14 | 15 | int min_moves = 0; 16 | if (a >= b) { 17 | double remainder = a % b; 18 | cout << remainder << "\n"; 19 | } else { 20 | double diff = abs(b-a); 21 | cout << diff << "\n"; 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Codeforces/800/1352A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | 7 | int main() { 8 | int t; 9 | cin >> t; 10 | while (t--) { 11 | cout << endl; 12 | int n; 13 | cin >> n; 14 | 15 | string num = to_string(n); 16 | 17 | int num_zeros = 0; 18 | 19 | for (int i=0; i 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | int t; 7 | cin >> t; 8 | 9 | while (t--) { 10 | 11 | string b; 12 | cin >> b; 13 | 14 | string res = ""; 15 | 16 | for (int i=0; i 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin >> n; 7 | 8 | float total = 100 * n; 9 | float fraction = 0; 10 | for (int i=0; i> current_drink; 13 | 14 | // cout << "current_drink - " << current_drink << "\n"; 15 | 16 | fraction += current_drink; 17 | } 18 | 19 | float res = (fraction / total) * 100; 20 | cout << res; 21 | } 22 | -------------------------------------------------------------------------------- /Codeforces/800/236A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | string user_name; 6 | cin >> user_name; 7 | 8 | int chars[26]; 9 | for (int i=0; i<26; i++) { 10 | chars[i] = 0; 11 | } 12 | 13 | for (char c : user_name) { 14 | chars[c-'a']++; 15 | } 16 | 17 | int distinct_chars = 0; 18 | for (int i=0; i<26; i++) { 19 | if (chars[i] >= 1) distinct_chars++; 20 | } 21 | 22 | if (distinct_chars % 2 == 0) { 23 | cout << "CHAT WITH HER!"; 24 | } else { 25 | cout << "IGNORE HIM!"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Codeforces/800/344A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | 9 | if (n == 1) { 10 | cout << 1; 11 | return 0; 12 | } 13 | 14 | int num_groups=0; 15 | 16 | string last_num; 17 | 18 | for (int i=0; i> current_num; 21 | 22 | if (current_num != last_num) { 23 | num_groups++; 24 | } 25 | 26 | last_num = current_num; 27 | } 28 | 29 | cout << num_groups; 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /Codeforces/800/41A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | string s; 6 | cin >> s; 7 | 8 | string t; 9 | cin >> t; 10 | 11 | int s_len = s.length(); 12 | int t_len = t.length(); 13 | 14 | if (s_len != t_len) { 15 | cout << "NO"; 16 | return 0; 17 | } else { 18 | int i = 0; 19 | int j = s_len-1; 20 | 21 | while (i < s_len && j >= 0) { 22 | if (s.at(i) != t.at(j)) { 23 | cout << "NO"; 24 | return 0; 25 | } 26 | i++; 27 | j--; 28 | } 29 | 30 | cout << "YES"; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Codeforces/800/431A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | int a1; 7 | cin >> a1; 8 | int a2; 9 | cin >> a2; 10 | int a3; 11 | cin >> a3; 12 | int a4; 13 | cin >> a4; 14 | 15 | string s; 16 | cin >> s; 17 | 18 | int num_seconds = 0; 19 | 20 | for (char c : s) { 21 | if (c == '1') { 22 | num_seconds += a1; 23 | } else if (c == '2') { 24 | num_seconds += a2; 25 | } else if (c == '3') { 26 | num_seconds += a3; 27 | } else { 28 | num_seconds += a4; 29 | } 30 | } 31 | 32 | cout << num_seconds; 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Codeforces/800/469A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() { 7 | int n; 8 | cin >> n; 9 | 10 | set nums; 11 | 12 | int p; 13 | cin >> p; 14 | 15 | for (int i=0; i> p_level; 18 | 19 | nums.insert(p_level); 20 | } 21 | 22 | int q; 23 | cin >> q; 24 | for (int i=0; i> q_level; 27 | 28 | nums.insert(q_level); 29 | } 30 | 31 | for (int i=1; i<=n; i++) { 32 | if (nums.count(i) == 0) { 33 | cout << "Oh, my keyboard!"; 34 | return 0; 35 | } 36 | } 37 | 38 | cout << "I become the guy."; 39 | return 0; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Codeforces/800/4A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include ; 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | int w; 8 | cin >> w; 9 | 10 | if (w > 2 && w % 2 == 0) { 11 | cout << "YES"; 12 | } else if (w == 2) { 13 | cout << "NO"; 14 | } else { 15 | cout << "NO"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Codeforces/800/734A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin >> n; 7 | 8 | string games; 9 | cin >> games; 10 | 11 | int anton_wins = 0; 12 | int danik_wins = 0; 13 | 14 | for (char c : games) { 15 | if (c == 'A') anton_wins++; 16 | if (c == 'D') danik_wins++; 17 | } 18 | 19 | if (anton_wins > danik_wins) cout << "Anton"; 20 | else if (anton_wins == danik_wins) cout << "Friendship"; 21 | else cout << "Danik"; 22 | } 23 | -------------------------------------------------------------------------------- /Codeforces/800/750A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | 9 | int k; 10 | cin >> k; 11 | 12 | int time_left = 240 - k; 13 | 14 | int num_problems = 0; 15 | int problem_num = 1; 16 | 17 | while (time_left > (5 * num_problems) && problem_num <= n) { 18 | time_left = time_left - (problem_num * 5); 19 | problem_num++; 20 | num_problems++; 21 | 22 | } 23 | 24 | if (time_left < 0) cout << num_problems-1; 25 | else cout << num_problems; 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /Codeforces/800/758A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | 7 | int n; 8 | cin >> n; 9 | 10 | int total = 0; 11 | int richest = 0; 12 | 13 | int accounts[n]; 14 | for (int i=0; i> amount; 17 | accounts[i] = amount; 18 | richest = max(richest, amount); 19 | total += amount; 20 | } 21 | 22 | int spend = 0; 23 | for (int i=0; i