diff options
72 files changed, 312 insertions, 0 deletions
diff --git a/BeautifulYear/inp b/BeautifulYear/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/BeautifulYear/inp diff --git a/BeautifulYear/main b/BeautifulYear/main Binary files differnew file mode 100755 index 0000000..ac627ae --- /dev/null +++ b/BeautifulYear/main diff --git a/BeautifulYear/main.cpp b/BeautifulYear/main.cpp new file mode 100644 index 0000000..31fa32d --- /dev/null +++ b/BeautifulYear/main.cpp @@ -0,0 +1,21 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int in; + cin >> in; + for(int i = in + 1; i <= 9500; i++) { + string s = to_string(i); + set<int> st; + for(auto ch : s) { + st.insert(ch - '0'); + } + if(st.size() == 4) { + cout << i << endl; + break; + } + } +} diff --git a/BeautifulYear/main_input0.txt b/BeautifulYear/main_input0.txt new file mode 100644 index 0000000..ef0a2ad --- /dev/null +++ b/BeautifulYear/main_input0.txt @@ -0,0 +1 @@ +1987 diff --git a/BeautifulYear/main_input1.txt b/BeautifulYear/main_input1.txt new file mode 100644 index 0000000..e355f6d --- /dev/null +++ b/BeautifulYear/main_input1.txt @@ -0,0 +1 @@ +2013 diff --git a/BeautifulYear/main_output0.txt b/BeautifulYear/main_output0.txt new file mode 100644 index 0000000..e355f6d --- /dev/null +++ b/BeautifulYear/main_output0.txt @@ -0,0 +1 @@ +2013 diff --git a/BeautifulYear/main_output1.txt b/BeautifulYear/main_output1.txt new file mode 100644 index 0000000..9ebee8e --- /dev/null +++ b/BeautifulYear/main_output1.txt @@ -0,0 +1 @@ +2014 diff --git a/Borze/inp b/Borze/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Borze/inp diff --git a/Borze/main b/Borze/main Binary files differnew file mode 100755 index 0000000..d6bf512 --- /dev/null +++ b/Borze/main diff --git a/Borze/main.cpp b/Borze/main.cpp new file mode 100644 index 0000000..b35852f --- /dev/null +++ b/Borze/main.cpp @@ -0,0 +1,14 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + s = regex_replace(s, regex("--"), "2"); + s = regex_replace(s, regex("-\\."), "1"); + s = regex_replace(s, regex("\\."), "0"); + cout << s << endl; +} diff --git a/Borze/main_input0.txt b/Borze/main_input0.txt new file mode 100644 index 0000000..0685e8c --- /dev/null +++ b/Borze/main_input0.txt @@ -0,0 +1 @@ +.-.-- diff --git a/Borze/main_input1.txt b/Borze/main_input1.txt new file mode 100644 index 0000000..7bb3b93 --- /dev/null +++ b/Borze/main_input1.txt @@ -0,0 +1 @@ +--. diff --git a/Borze/main_input2.txt b/Borze/main_input2.txt new file mode 100644 index 0000000..c8b3186 --- /dev/null +++ b/Borze/main_input2.txt @@ -0,0 +1 @@ +-..-.-- diff --git a/Borze/main_output0.txt b/Borze/main_output0.txt new file mode 100644 index 0000000..de97a6d --- /dev/null +++ b/Borze/main_output0.txt @@ -0,0 +1 @@ +012 diff --git a/Borze/main_output1.txt b/Borze/main_output1.txt new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/Borze/main_output1.txt @@ -0,0 +1 @@ +20 diff --git a/Borze/main_output2.txt b/Borze/main_output2.txt new file mode 100644 index 0000000..2d1420d --- /dev/null +++ b/Borze/main_output2.txt @@ -0,0 +1 @@ +1012 diff --git a/LightsOut/inp b/LightsOut/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/LightsOut/inp diff --git a/LightsOut/main b/LightsOut/main Binary files differnew file mode 100755 index 0000000..8462cbf --- /dev/null +++ b/LightsOut/main diff --git a/LightsOut/main.cpp b/LightsOut/main.cpp new file mode 100644 index 0000000..6b49d5d --- /dev/null +++ b/LightsOut/main.cpp @@ -0,0 +1,47 @@ +#include<bits/stdc++.h> + +using namespace std; + +bool safeMove(int i, int j) { + if(i < 0 || i > 2 || j < 0 || j > 2) { + return false; + } + return true; +} + +vector<vector<int>> sumAdjacents(vector<vector<int>> v) { + vector<vector<int>> ans(3, vector<int> (3)); + vector<int> dx = {1, 0, -1, 0}; + vector<int> dy = {0, 1, 0, -1}; + for(int i = 0; i < v.size();i++) { + for(int j = 0; j < v[i].size(); j++) { + ans[i][j] += v[i][j]; + for(int k = 0; k < 4; k++) { + int x = i + dx[k]; + int y = j + dy[k]; + if(safeMove(x, y)) { + ans[i][j] += v[x][y]; + } + } + (ans[i][j] & 1) ? ans[i][j] = 0 : ans[i][j] = 1; + } + } + return ans; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + vector<vector<int>> v (3, vector<int> (3)); + for(auto &x : v) { + for(auto &y : x) { + cin >> y; + } + } + for(auto x : sumAdjacents(v)) { + for(auto z : x) { + cout << z; + } + cout << endl; + } +} diff --git a/LightsOut/main_input0.txt b/LightsOut/main_input0.txt new file mode 100644 index 0000000..4d005ec --- /dev/null +++ b/LightsOut/main_input0.txt @@ -0,0 +1,3 @@ +1 0 0 +0 0 0 +0 0 1 diff --git a/LightsOut/main_input1.txt b/LightsOut/main_input1.txt new file mode 100644 index 0000000..200a92e --- /dev/null +++ b/LightsOut/main_input1.txt @@ -0,0 +1,3 @@ +1 0 1 +8 8 8 +2 0 3 diff --git a/LightsOut/main_output0.txt b/LightsOut/main_output0.txt new file mode 100644 index 0000000..4c5ffb7 --- /dev/null +++ b/LightsOut/main_output0.txt @@ -0,0 +1,3 @@ +001 +010 +100 diff --git a/LightsOut/main_output1.txt b/LightsOut/main_output1.txt new file mode 100644 index 0000000..94207d9 --- /dev/null +++ b/LightsOut/main_output1.txt @@ -0,0 +1,3 @@ +010 +011 +100 diff --git a/NearlyLuckyNumber/inp b/NearlyLuckyNumber/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/NearlyLuckyNumber/inp diff --git a/NearlyLuckyNumber/main b/NearlyLuckyNumber/main Binary files differnew file mode 100755 index 0000000..508d7ae --- /dev/null +++ b/NearlyLuckyNumber/main diff --git a/NearlyLuckyNumber/main.cpp b/NearlyLuckyNumber/main.cpp new file mode 100644 index 0000000..d807b1a --- /dev/null +++ b/NearlyLuckyNumber/main.cpp @@ -0,0 +1,31 @@ +#include<bits/stdc++.h> + +using namespace std; + +bool isLucky(string s) { + for(int i = 0; i < s.size(); i++) { + if(s[i] != '4' && s[i] != '7') { + return false; + } + } + return true; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + long long n; + cin >> n; + string s = to_string(n); + int cnt = 0; + for(auto ch : s) { + if(ch == '4' || ch == '7') { + cnt ++; + } + } + if(isLucky(to_string(cnt))) { + cout << "YES"; + } else { + cout << "NO"; + } +} diff --git a/NearlyLuckyNumber/main_input0.txt b/NearlyLuckyNumber/main_input0.txt new file mode 100644 index 0000000..86b9da8 --- /dev/null +++ b/NearlyLuckyNumber/main_input0.txt @@ -0,0 +1 @@ +40047 diff --git a/NearlyLuckyNumber/main_input1.txt b/NearlyLuckyNumber/main_input1.txt new file mode 100644 index 0000000..92660b6 --- /dev/null +++ b/NearlyLuckyNumber/main_input1.txt @@ -0,0 +1 @@ +7747774 diff --git a/NearlyLuckyNumber/main_input2.txt b/NearlyLuckyNumber/main_input2.txt new file mode 100644 index 0000000..c9a4149 --- /dev/null +++ b/NearlyLuckyNumber/main_input2.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/NearlyLuckyNumber/main_output0.txt b/NearlyLuckyNumber/main_output0.txt new file mode 100644 index 0000000..5e35d1b --- /dev/null +++ b/NearlyLuckyNumber/main_output0.txt @@ -0,0 +1 @@ +NO diff --git a/NearlyLuckyNumber/main_output1.txt b/NearlyLuckyNumber/main_output1.txt new file mode 100644 index 0000000..f033a50 --- /dev/null +++ b/NearlyLuckyNumber/main_output1.txt @@ -0,0 +1 @@ +YES diff --git a/NearlyLuckyNumber/main_output2.txt b/NearlyLuckyNumber/main_output2.txt new file mode 100644 index 0000000..5e35d1b --- /dev/null +++ b/NearlyLuckyNumber/main_output2.txt @@ -0,0 +1 @@ +NO diff --git a/StonesOnTheTable/inp b/StonesOnTheTable/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/StonesOnTheTable/inp diff --git a/StonesOnTheTable/main b/StonesOnTheTable/main Binary files differnew file mode 100755 index 0000000..800895c --- /dev/null +++ b/StonesOnTheTable/main diff --git a/StonesOnTheTable/main.cpp b/StonesOnTheTable/main.cpp new file mode 100644 index 0000000..b7bf69e --- /dev/null +++ b/StonesOnTheTable/main.cpp @@ -0,0 +1,21 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n; + cin >> n; + string s; + cin >> s; + map<char, int> mp; + for(auto ch : s) { + mp[ch]++; + } + int mx = 0; + for(auto p : mp) { + mx = max(p.second, mx); + } + cout << mx - 1 << endl; +} diff --git a/StonesOnTheTable/main_input0.txt b/StonesOnTheTable/main_input0.txt new file mode 100644 index 0000000..5de4d9a --- /dev/null +++ b/StonesOnTheTable/main_input0.txt @@ -0,0 +1,2 @@ +3 +RRG diff --git a/StonesOnTheTable/main_input1.txt b/StonesOnTheTable/main_input1.txt new file mode 100644 index 0000000..f4dad44 --- /dev/null +++ b/StonesOnTheTable/main_input1.txt @@ -0,0 +1,2 @@ +5 +RRRRR diff --git a/StonesOnTheTable/main_input2.txt b/StonesOnTheTable/main_input2.txt new file mode 100644 index 0000000..b7900c6 --- /dev/null +++ b/StonesOnTheTable/main_input2.txt @@ -0,0 +1,2 @@ +4 +BRBG diff --git a/StonesOnTheTable/main_output0.txt b/StonesOnTheTable/main_output0.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/StonesOnTheTable/main_output0.txt @@ -0,0 +1 @@ +1 diff --git a/StonesOnTheTable/main_output1.txt b/StonesOnTheTable/main_output1.txt new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/StonesOnTheTable/main_output1.txt @@ -0,0 +1 @@ +4 diff --git a/StonesOnTheTable/main_output2.txt b/StonesOnTheTable/main_output2.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/StonesOnTheTable/main_output2.txt @@ -0,0 +1 @@ +0 diff --git a/Word/inp b/Word/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Word/inp diff --git a/Word/main b/Word/main Binary files differnew file mode 100755 index 0000000..01dfeb5 --- /dev/null +++ b/Word/main diff --git a/Word/main.cpp b/Word/main.cpp new file mode 100644 index 0000000..31937b2 --- /dev/null +++ b/Word/main.cpp @@ -0,0 +1,34 @@ +#include<bits/stdc++.h> +#include <cctype> + +using namespace std; + +string convertLower(string s) { + for(auto &ch : s) { + ch = tolower(ch); + } + return s; +} +string convertUpper(string s) { + for(auto &ch : s) { + ch = toupper(ch); + } + return s; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + int l = 0; + int u = 0; + for(auto ch : s) { + if(islower(ch)) { + l++; + } else { + u++; + } + } + cout << (l < u ? convertUpper(s) : convertLower(s)); +} diff --git a/Word/main_input0.txt b/Word/main_input0.txt new file mode 100644 index 0000000..dcf8e7c --- /dev/null +++ b/Word/main_input0.txt @@ -0,0 +1 @@ +HoUse diff --git a/Word/main_input1.txt b/Word/main_input1.txt new file mode 100644 index 0000000..619b51b --- /dev/null +++ b/Word/main_input1.txt @@ -0,0 +1 @@ +ViP diff --git a/Word/main_input2.txt b/Word/main_input2.txt new file mode 100644 index 0000000..b6751f3 --- /dev/null +++ b/Word/main_input2.txt @@ -0,0 +1 @@ +maTRIx diff --git a/Word/main_output0.txt b/Word/main_output0.txt new file mode 100644 index 0000000..90dde25 --- /dev/null +++ b/Word/main_output0.txt @@ -0,0 +1 @@ +house diff --git a/Word/main_output1.txt b/Word/main_output1.txt new file mode 100644 index 0000000..7077ce5 --- /dev/null +++ b/Word/main_output1.txt @@ -0,0 +1 @@ +VIP diff --git a/Word/main_output2.txt b/Word/main_output2.txt new file mode 100644 index 0000000..f5f6bec --- /dev/null +++ b/Word/main_output2.txt @@ -0,0 +1 @@ +matrix diff --git a/WordCapitalization/inp b/WordCapitalization/inp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/WordCapitalization/inp diff --git a/WordCapitalization/main b/WordCapitalization/main Binary files differnew file mode 100755 index 0000000..e8a49da --- /dev/null +++ b/WordCapitalization/main diff --git a/WordCapitalization/main.cpp b/WordCapitalization/main.cpp new file mode 100644 index 0000000..057e47f --- /dev/null +++ b/WordCapitalization/main.cpp @@ -0,0 +1,12 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + s[0] = toupper(s[0]); + cout << s << endl; +} diff --git a/WordCapitalization/main_input0.txt b/WordCapitalization/main_input0.txt new file mode 100644 index 0000000..a032af3 --- /dev/null +++ b/WordCapitalization/main_input0.txt @@ -0,0 +1 @@ +ApPLe diff --git a/WordCapitalization/main_input1.txt b/WordCapitalization/main_input1.txt new file mode 100644 index 0000000..32edabd --- /dev/null +++ b/WordCapitalization/main_input1.txt @@ -0,0 +1 @@ +konjac diff --git a/WordCapitalization/main_output0.txt b/WordCapitalization/main_output0.txt new file mode 100644 index 0000000..a032af3 --- /dev/null +++ b/WordCapitalization/main_output0.txt @@ -0,0 +1 @@ +ApPLe diff --git a/WordCapitalization/main_output1.txt b/WordCapitalization/main_output1.txt new file mode 100644 index 0000000..a0a3cf9 --- /dev/null +++ b/WordCapitalization/main_output1.txt @@ -0,0 +1 @@ +Konjac |
