diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-06 23:23:53 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-06 23:23:53 +0200 |
| commit | ed4b0690e4ee35278bb656c703bd0a1ab102222f (patch) | |
| tree | fc880ae4d999fbd54e6d370073eb18291da475cd | |
| parent | 27b754215ceda985f0f8e3b64ab5c5f8e84ab826 (diff) | |
| download | competitive-programming-ed4b0690e4ee35278bb656c703bd0a1ab102222f.tar.xz competitive-programming-ed4b0690e4ee35278bb656c703bd0a1ab102222f.zip | |
Added some problems + moved some folders to contests
26 files changed, 13 insertions, 329 deletions
diff --git a/05-05-2022(Div.3)/A/A.cpp b/05-05-2022(Div.3)/A/A.cpp deleted file mode 100644 index 2f5fb6b..0000000 --- a/05-05-2022(Div.3)/A/A.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main() { - int tt,a,b,c,x,y,remX,remY; - cin >> tt; - while (tt--) { - cin >> a >> b >> c >> x >> y; - if(a > x && b < y) { - remX = 0; - remY = y - b; - } - else if (a < x && b > y) { - remX = x - a; - remY = 0; - } - else if (a > x && b > y) { - remX =0; - remY =0; - } - else { - remX = x - a; - remY = y - b; - } - if(c == 0) { - if(a >= x && b >= y) { - cout << "YES" << endl; - } - else { - cout << "NO" << endl; - } - } - else if(c >= remX + remY) { - cout << "YES" << endl; - } - else { - cout << "NO" << endl; - } - - } -} diff --git a/05-05-2022(Div.3)/C/C.py b/05-05-2022(Div.3)/C/C.py deleted file mode 100755 index 422b0f7..0000000 --- a/05-05-2022(Div.3)/C/C.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python3 - -t = int(input()) -while(t): - t-=1 - s = input() - one = 0 - zero = len(s) - 1 - for i in range(len(s)): - if s[i] == '0': - zero = i - break - for i in range(len(s)): - if s[i] == '1': - one = i - print(zero - one + 1) - diff --git a/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob b/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob deleted file mode 100644 index 52ce51e..0000000 --- a/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob +++ /dev/null @@ -1 +0,0 @@ -{"name":"A. Deletions of Two Adjacent Letters","group":"Codeforces - Codeforces Round #776 (Div. 3)","url":"https://codeforces.com/contest/1650/problem/0","interactive":false,"memoryLimit":256,"timeLimit":2000,"tests":[{"id":1646751197936,"input":"5\nabcde\nc\nabcde\nb\nx\ny\naaaaaaaaaaaaaaa\na\ncontest\nt","output":"YES\nNO\nNO\nYES\nYES"},{"id":1646853307171,"input":"1\nqjjyzcsjy\ns","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ADeletionsOfTwoAdjacentLetters"}},"batch":{"id":"b130b25d-3d3d-4fce-9d67-8671131df21f","size":1},"srcPath":"/home/peng/test/Problem_Solving/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp"}
\ No newline at end of file diff --git a/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob b/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob deleted file mode 100644 index 7eca9cb..0000000 --- a/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob +++ /dev/null @@ -1 +0,0 @@ -{"name":"B. DIV + MOD","group":"Codeforces - Codeforces Round #776 (Div. 3)","url":"https://codeforces.com/contest/1650/problem/B","interactive":false,"memoryLimit":256,"timeLimit":2000,"tests":[{"id":1646752657834,"input":"5\n1 4 3\n5 8 4\n6 10 6\n1 1000000000 1000000000\n10 12 8","output":"2\n4\n5\n999999999\n5"},{"id":1646833131418,"input":"1\n1 100 1","output":"100"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BDIVMOD"}},"batch":{"id":"18dc3187-28ba-42e4-adb6-b241bf475a66","size":1},"srcPath":"/home/peng/test/Problem_Solving/08-03-2022(Div.3)/B_DIV_MOD.cpp"}
\ No newline at end of file diff --git a/08-03-2022(Div.3)/A b/08-03-2022(Div.3)/A Binary files differdeleted file mode 100755 index a2ce84f..0000000 --- a/08-03-2022(Div.3)/A +++ /dev/null diff --git a/08-03-2022(Div.3)/A.cpp b/08-03-2022(Div.3)/A.cpp deleted file mode 100644 index 741b57a..0000000 --- a/08-03-2022(Div.3)/A.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main(){ - int tt; - cin >> tt; - while(tt--){ - string word; - char ch; - cin >> word; - cin >> ch; - int len = word.length(); - if(word[len/2 + 1] == ch){ - cout << word[len/2 + 1] << endl; - cout << ch << endl; - cout << "YES" << "\n"; - } - else{ - cout << "NO" << "\n"; - } - } - - return 0; -}
\ No newline at end of file diff --git a/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters b/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters Binary files differdeleted file mode 100755 index c79eb1d..0000000 --- a/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters +++ /dev/null diff --git a/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp b/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp deleted file mode 100644 index 3f7daa2..0000000 --- a/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -void findMultOcc(vector<int> &indices, string str, char ch){ - for(int i = 0; i < str.length();i++){ - if(str[i] == ch){ - indices.push_back(i); - } - } -} - -string solve(vector<int> indices){ - for(int i = 0; i < indices.size(); i++) - { - if(indices[i] >= 0 && indices[i] % 2 == 0){ - return "YES"; - } - } - return "NO"; -} - -int main(){ - int tt; - cin >> tt; - while(tt--){ - vector<int> indices; - string word; - char ch; - cin >> word; - cin >> ch; - findMultOcc(indices, word, ch); - cout << solve(indices) << '\n'; - } - - return 0; -} diff --git a/08-03-2022(Div.3)/B b/08-03-2022(Div.3)/B Binary files differdeleted file mode 100755 index b11c838..0000000 --- a/08-03-2022(Div.3)/B +++ /dev/null diff --git a/08-03-2022(Div.3)/B.cpp b/08-03-2022(Div.3)/B.cpp deleted file mode 100644 index dd8bb54..0000000 --- a/08-03-2022(Div.3)/B.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int modDiv(int r, int a){ - // law r % a == 0, return r-1 % a + r-1 /a, else return r % a + r /a; - if(r % a == 0){ - return (r-1) % a + (r-1)/a; - } - return r % a + r / a; -} - -int main(){ - int tt; - while(tt--){ - cout << "tt: " << tt; - int l, r, a; - cin >> l >> r >> a; - cout << modDiv(r, a); - } - - return 0; -}
\ No newline at end of file diff --git a/08-03-2022(Div.3)/B_DIV_MOD.cpp b/08-03-2022(Div.3)/B_DIV_MOD.cpp deleted file mode 100644 index f861b3b..0000000 --- a/08-03-2022(Div.3)/B_DIV_MOD.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int modDiv(int r, int a){ - // law r % a == 0, return r-1 % a + r-1 /a, else return r % a + r /a; - if(r % a == 0){ - return (r-1) % a + (r-1)/a; - } - return r % a + r / a; -} - -int main(){ - int tt; - cin >> tt; - while(tt--){ - int l, r, a; - cin >> l >> r >> a; - cout << modDiv(r, a) << endl; - } - - return 0; -} diff --git a/08-03-2022(Div.3)/C.cpp b/08-03-2022(Div.3)/C.cpp deleted file mode 100644 index f63ebcd..0000000 --- a/08-03-2022(Div.3)/C.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main(){ - int tt; - cin >> tt; - while(tt--){ - list<int> ls; - int len; - int x; - cin >> len; - for(int i = 0; i < len; i++){ - cin >> x; - ls.push_back(x); - } - - - } - - return 0; -}
\ No newline at end of file diff --git a/08-03-2022(Div.3)/D.cpp b/08-03-2022(Div.3)/D.cpp deleted file mode 100644 index 0572f03..0000000 --- a/08-03-2022(Div.3)/D.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int solve() -{ - -} - -int main(){ - int tt; - cin >> tt; - while(tt--){ - - - } - - - return 0; -} diff --git a/08-03-2022(Div.3)/E.cpp b/08-03-2022(Div.3)/E.cpp deleted file mode 100644 index 2601cd5..0000000 --- a/08-03-2022(Div.3)/E.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main(){ - int tt; - - return 0; -}
\ No newline at end of file diff --git a/08-03-2022(Div.3)/tempCodeRunnerFile b/08-03-2022(Div.3)/tempCodeRunnerFile Binary files differdeleted file mode 100755 index 9154686..0000000 --- a/08-03-2022(Div.3)/tempCodeRunnerFile +++ /dev/null diff --git a/21-04-2022(Div.4)/A b/21-04-2022(Div.4)/A Binary files differdeleted file mode 100755 index 58be759..0000000 --- a/21-04-2022(Div.4)/A +++ /dev/null diff --git a/21-04-2022(Div.4)/A.cpp b/21-04-2022(Div.4)/A.cpp deleted file mode 100644 index 35c326e..0000000 --- a/21-04-2022(Div.4)/A.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main(){ - int tt, x; - cin >> tt; - while(tt--){ - cin >> x; - if(x >= 1900){ - cout << "Division 1" << '\n'; - } - else if(x >= 1600 && x <= 1899){ - cout << "Division 2" << '\n'; - } - else if(x >= 1400 && x <= 1599){ - cout << "Division 3" << '\n'; - } - else{ - cout << "Division 4" << '\n'; - } - } -} diff --git a/21-04-2022(Div.4)/B b/21-04-2022(Div.4)/B Binary files differdeleted file mode 100755 index 6a9b6ab..0000000 --- a/21-04-2022(Div.4)/B +++ /dev/null diff --git a/21-04-2022(Div.4)/B.cpp b/21-04-2022(Div.4)/B.cpp deleted file mode 100644 index d1b3e98..0000000 --- a/21-04-2022(Div.4)/B.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -auto solve(map<int, int> m){ - for(auto x : m){ - if(x.second >= 3){ - return x.first; - } - } - return -1; -} - -int main(){ - int tt, x, n; - cin >> tt; - while(tt--){ - map<int, int> frq; - vector<int> v; - cin >> n; - for(int i = 0; i < n; i++){ - cin >> x; - frq[x]++; - } - // for(auto &x : frq){ - // v.push_back(x.second); - // } - cout << solve(frq) << endl; - } -} diff --git a/21-04-2022(Div.4)/E b/21-04-2022(Div.4)/E Binary files differdeleted file mode 100755 index 0e57ed4..0000000 --- a/21-04-2022(Div.4)/E +++ /dev/null diff --git a/21-04-2022(Div.4)/E.cpp b/21-04-2022(Div.4)/E.cpp deleted file mode 100644 index 7fac1a5..0000000 --- a/21-04-2022(Div.4)/E.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main(){ - int tt, n, count; - cin >> tt; - while(tt--){ - string str; - cin >> n; - count = 0; - vector<string> v(n); - for(int i = 0; i < n; i++){ - cin >> v[i]; - } - for(int i = 0; i < v.size(); i++){ - for(int j = i+1; j < v.size()-1; j++){ - if(v[i][0] != v[j][0] || v[i][1] != v[j][1]){ - count++; - } - } - } - cout << count << endl; - } -} diff --git a/21-04-2022(Div.4)/F b/21-04-2022(Div.4)/F Binary files differdeleted file mode 100755 index b87fe94..0000000 --- a/21-04-2022(Div.4)/F +++ /dev/null diff --git a/21-04-2022(Div.4)/F.cpp b/21-04-2022(Div.4)/F.cpp deleted file mode 100644 index 4ab1a8c..0000000 --- a/21-04-2022(Div.4)/F.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main(){ - -} diff --git a/AlternatingCharachters.py b/AlternatingCharachters.py deleted file mode 100755 index cb0a56c..0000000 --- a/AlternatingCharachters.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/python3 -t = int(input()) -for i in range(t): - s = input() - count = 0 - for j in range(len(s) - 1): - # print(s[j] == s[j + 1]) - if s[j] == s[j + 1]: - count += 1 - print(count) - - diff --git a/cleanBinaries.sh b/cleanBinaries.sh deleted file mode 100755 index d3ac8be..0000000 --- a/cleanBinaries.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -mv !(*.cpp) binaries diff --git a/recursionTest.cpp b/recursionTest.cpp index ae3ab32..91e9db8 100644 --- a/recursionTest.cpp +++ b/recursionTest.cpp @@ -1,3 +1,4 @@ +#include <algorithm> #include<bits/stdc++.h> using namespace std; @@ -31,17 +32,20 @@ int main() { for(int &x : v) { cin >> x; } - if(solve(v, 0, target, v[0], opts)) { - for(int i = 0; i < v.size(); i++) { - if (i == v.size() - 1) { - cout << v[i]; - } - else { - cout << v[i] << " " << ans[i] << " "; + sort(v.begin(), v.end()); + do { + if(solve(v, 0, target, v[0], opts)) { + for(int i = 0; i < v.size(); i++) { + if (i == v.size() - 1) { + cout << v[i]; + } + else { + cout << v[i] << " " << ans[i] << " "; + } } + cout << '\n'; } - cout << '\n'; - } + } while(next_permutation(v.begin(), v.end())); return 0; } |
