From 9dce6eaf425178ab1c37dc15b3a74f09e23e9243 Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Fri, 6 May 2022 23:24:22 +0200 Subject: Added contests file --- contests/05-05-2022(Div.3)/A/A | Bin 0 -> 17848 bytes contests/05-05-2022(Div.3)/A/A.cpp | 42 +++++++++++++++++ contests/05-05-2022(Div.3)/B/B | Bin 0 -> 33024 bytes contests/05-05-2022(Div.3)/B/B.cpp | 48 ++++++++++++++++++++ contests/05-05-2022(Div.3)/C/C.cpp | 1 + contests/05-05-2022(Div.3)/C/C.py | 17 +++++++ contests/05-05-2022(Div.3)/D/D.cpp | 0 contests/05-05-2022(Div.3)/E/E.cpp | 0 contests/05-05-2022(Div.3)/F/F.cpp | 0 ...tters.cpp_691f772586c92182cd3ca9396098375f.prob | 1 + ...V_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob | 1 + contests/08-03-2022(Div.3)/A | Bin 0 -> 18880 bytes contests/08-03-2022(Div.3)/A.cpp | 25 +++++++++++ .../A_Deletions_of_Two_Adjacent_Letters | Bin 0 -> 18664 bytes .../A_Deletions_of_Two_Adjacent_Letters.cpp | 37 +++++++++++++++ contests/08-03-2022(Div.3)/B | Bin 0 -> 17688 bytes contests/08-03-2022(Div.3)/B.cpp | 23 ++++++++++ contests/08-03-2022(Div.3)/B_DIV_MOD.cpp | 23 ++++++++++ contests/08-03-2022(Div.3)/C.cpp | 22 +++++++++ contests/08-03-2022(Div.3)/D.cpp | 20 +++++++++ contests/08-03-2022(Div.3)/E.cpp | 9 ++++ contests/08-03-2022(Div.3)/tempCodeRunnerFile | Bin 0 -> 18640 bytes contests/21-04-2022(Div.4)/A | Bin 0 -> 17792 bytes contests/21-04-2022(Div.4)/A.cpp | 23 ++++++++++ contests/21-04-2022(Div.4)/B | Bin 0 -> 47400 bytes contests/21-04-2022(Div.4)/B.cpp | 30 +++++++++++++ contests/21-04-2022(Div.4)/E | Bin 0 -> 24728 bytes contests/21-04-2022(Div.4)/E.cpp | 25 +++++++++++ contests/21-04-2022(Div.4)/F | Bin 0 -> 22712 bytes contests/21-04-2022(Div.4)/F.cpp | 7 +++ contests/Round#788/A(2_pointers).cpp | 29 ++++++++++++ contests/Round#788/A.cpp | 50 +++++++++++++++++++++ contests/Round#788/B.cpp | 7 +++ contests/Round#788/C.cpp | 7 +++ contests/Round#788/D.cpp | 7 +++ contests/Round#788/E.cpp | 7 +++ contests/Round#788/F.cpp | 7 +++ python/RecursiveDigitSum.py | 15 +++++++ 38 files changed, 483 insertions(+) create mode 100755 contests/05-05-2022(Div.3)/A/A create mode 100644 contests/05-05-2022(Div.3)/A/A.cpp create mode 100755 contests/05-05-2022(Div.3)/B/B create mode 100644 contests/05-05-2022(Div.3)/B/B.cpp create mode 100644 contests/05-05-2022(Div.3)/C/C.cpp create mode 100755 contests/05-05-2022(Div.3)/C/C.py create mode 100644 contests/05-05-2022(Div.3)/D/D.cpp create mode 100644 contests/05-05-2022(Div.3)/E/E.cpp create mode 100644 contests/05-05-2022(Div.3)/F/F.cpp create mode 100644 contests/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob create mode 100644 contests/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob create mode 100755 contests/08-03-2022(Div.3)/A create mode 100644 contests/08-03-2022(Div.3)/A.cpp create mode 100755 contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters create mode 100644 contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp create mode 100755 contests/08-03-2022(Div.3)/B create mode 100644 contests/08-03-2022(Div.3)/B.cpp create mode 100644 contests/08-03-2022(Div.3)/B_DIV_MOD.cpp create mode 100644 contests/08-03-2022(Div.3)/C.cpp create mode 100644 contests/08-03-2022(Div.3)/D.cpp create mode 100644 contests/08-03-2022(Div.3)/E.cpp create mode 100755 contests/08-03-2022(Div.3)/tempCodeRunnerFile create mode 100755 contests/21-04-2022(Div.4)/A create mode 100644 contests/21-04-2022(Div.4)/A.cpp create mode 100755 contests/21-04-2022(Div.4)/B create mode 100644 contests/21-04-2022(Div.4)/B.cpp create mode 100755 contests/21-04-2022(Div.4)/E create mode 100644 contests/21-04-2022(Div.4)/E.cpp create mode 100755 contests/21-04-2022(Div.4)/F create mode 100644 contests/21-04-2022(Div.4)/F.cpp create mode 100644 contests/Round#788/A(2_pointers).cpp create mode 100644 contests/Round#788/A.cpp create mode 100644 contests/Round#788/B.cpp create mode 100644 contests/Round#788/C.cpp create mode 100644 contests/Round#788/D.cpp create mode 100644 contests/Round#788/E.cpp create mode 100644 contests/Round#788/F.cpp create mode 100755 python/RecursiveDigitSum.py diff --git a/contests/05-05-2022(Div.3)/A/A b/contests/05-05-2022(Div.3)/A/A new file mode 100755 index 0000000..7c1c04e Binary files /dev/null and b/contests/05-05-2022(Div.3)/A/A differ diff --git a/contests/05-05-2022(Div.3)/A/A.cpp b/contests/05-05-2022(Div.3)/A/A.cpp new file mode 100644 index 0000000..2f5fb6b --- /dev/null +++ b/contests/05-05-2022(Div.3)/A/A.cpp @@ -0,0 +1,42 @@ +#include + +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/contests/05-05-2022(Div.3)/B/B b/contests/05-05-2022(Div.3)/B/B new file mode 100755 index 0000000..af9715e Binary files /dev/null and b/contests/05-05-2022(Div.3)/B/B differ diff --git a/contests/05-05-2022(Div.3)/B/B.cpp b/contests/05-05-2022(Div.3)/B/B.cpp new file mode 100644 index 0000000..27c4853 --- /dev/null +++ b/contests/05-05-2022(Div.3)/B/B.cpp @@ -0,0 +1,48 @@ +#include + +using namespace std; + +bool isIncreasing(vector v){ + for(int i = 0; i < v.size() - 1; i++) { + if(v[i] >= v[i+1]) { + return false; + } + } + return true; +} +int getIndex(vector v){ + int index; + for(int i = 0; i < v.size(); i++) { + vector v2(i+1); + for(int j = 0; j <= i;j++){ + index = j; + v2[j] = v[j]; + } + if(!isIncreasing(v2)) { + return index; + } + } + return -1; +} + +int main () { + int tt, n; + cin >> tt; + while(tt--) { + cin >> n; + vector v(n); + for(auto &x : v) { + cin >> x; + } + int idx = getIndex(v); + vector rem(v.size() - idx); + if(idx == -1) { + cout << "0" << endl; + } else { + for(int i = 0;i < v.size() - idx; i++) { + rem[i] = v[idx + i]; + } + } + } + +} diff --git a/contests/05-05-2022(Div.3)/C/C.cpp b/contests/05-05-2022(Div.3)/C/C.cpp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/contests/05-05-2022(Div.3)/C/C.cpp @@ -0,0 +1 @@ + diff --git a/contests/05-05-2022(Div.3)/C/C.py b/contests/05-05-2022(Div.3)/C/C.py new file mode 100755 index 0000000..422b0f7 --- /dev/null +++ b/contests/05-05-2022(Div.3)/C/C.py @@ -0,0 +1,17 @@ +#!/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/contests/05-05-2022(Div.3)/D/D.cpp b/contests/05-05-2022(Div.3)/D/D.cpp new file mode 100644 index 0000000..e69de29 diff --git a/contests/05-05-2022(Div.3)/E/E.cpp b/contests/05-05-2022(Div.3)/E/E.cpp new file mode 100644 index 0000000..e69de29 diff --git a/contests/05-05-2022(Div.3)/F/F.cpp b/contests/05-05-2022(Div.3)/F/F.cpp new file mode 100644 index 0000000..e69de29 diff --git a/contests/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob b/contests/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob new file mode 100644 index 0000000..52ce51e --- /dev/null +++ b/contests/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob @@ -0,0 +1 @@ +{"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/contests/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob b/contests/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob new file mode 100644 index 0000000..7eca9cb --- /dev/null +++ b/contests/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob @@ -0,0 +1 @@ +{"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/contests/08-03-2022(Div.3)/A b/contests/08-03-2022(Div.3)/A new file mode 100755 index 0000000..a2ce84f Binary files /dev/null and b/contests/08-03-2022(Div.3)/A differ diff --git a/contests/08-03-2022(Div.3)/A.cpp b/contests/08-03-2022(Div.3)/A.cpp new file mode 100644 index 0000000..741b57a --- /dev/null +++ b/contests/08-03-2022(Div.3)/A.cpp @@ -0,0 +1,25 @@ +#include + +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/contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters b/contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters new file mode 100755 index 0000000..c79eb1d Binary files /dev/null and b/contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters differ diff --git a/contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp b/contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp new file mode 100644 index 0000000..3f7daa2 --- /dev/null +++ b/contests/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp @@ -0,0 +1,37 @@ +#include + +using namespace std; + +void findMultOcc(vector &indices, string str, char ch){ + for(int i = 0; i < str.length();i++){ + if(str[i] == ch){ + indices.push_back(i); + } + } +} + +string solve(vector 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 indices; + string word; + char ch; + cin >> word; + cin >> ch; + findMultOcc(indices, word, ch); + cout << solve(indices) << '\n'; + } + + return 0; +} diff --git a/contests/08-03-2022(Div.3)/B b/contests/08-03-2022(Div.3)/B new file mode 100755 index 0000000..b11c838 Binary files /dev/null and b/contests/08-03-2022(Div.3)/B differ diff --git a/contests/08-03-2022(Div.3)/B.cpp b/contests/08-03-2022(Div.3)/B.cpp new file mode 100644 index 0000000..dd8bb54 --- /dev/null +++ b/contests/08-03-2022(Div.3)/B.cpp @@ -0,0 +1,23 @@ +#include + +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/contests/08-03-2022(Div.3)/B_DIV_MOD.cpp b/contests/08-03-2022(Div.3)/B_DIV_MOD.cpp new file mode 100644 index 0000000..f861b3b --- /dev/null +++ b/contests/08-03-2022(Div.3)/B_DIV_MOD.cpp @@ -0,0 +1,23 @@ +#include + +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/contests/08-03-2022(Div.3)/C.cpp b/contests/08-03-2022(Div.3)/C.cpp new file mode 100644 index 0000000..f63ebcd --- /dev/null +++ b/contests/08-03-2022(Div.3)/C.cpp @@ -0,0 +1,22 @@ +#include + +using namespace std; + +int main(){ + int tt; + cin >> tt; + while(tt--){ + list 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/contests/08-03-2022(Div.3)/D.cpp b/contests/08-03-2022(Div.3)/D.cpp new file mode 100644 index 0000000..0572f03 --- /dev/null +++ b/contests/08-03-2022(Div.3)/D.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int solve() +{ + +} + +int main(){ + int tt; + cin >> tt; + while(tt--){ + + + } + + + return 0; +} diff --git a/contests/08-03-2022(Div.3)/E.cpp b/contests/08-03-2022(Div.3)/E.cpp new file mode 100644 index 0000000..2601cd5 --- /dev/null +++ b/contests/08-03-2022(Div.3)/E.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main(){ + int tt; + + return 0; +} \ No newline at end of file diff --git a/contests/08-03-2022(Div.3)/tempCodeRunnerFile b/contests/08-03-2022(Div.3)/tempCodeRunnerFile new file mode 100755 index 0000000..9154686 Binary files /dev/null and b/contests/08-03-2022(Div.3)/tempCodeRunnerFile differ diff --git a/contests/21-04-2022(Div.4)/A b/contests/21-04-2022(Div.4)/A new file mode 100755 index 0000000..58be759 Binary files /dev/null and b/contests/21-04-2022(Div.4)/A differ diff --git a/contests/21-04-2022(Div.4)/A.cpp b/contests/21-04-2022(Div.4)/A.cpp new file mode 100644 index 0000000..35c326e --- /dev/null +++ b/contests/21-04-2022(Div.4)/A.cpp @@ -0,0 +1,23 @@ +#include + +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/contests/21-04-2022(Div.4)/B b/contests/21-04-2022(Div.4)/B new file mode 100755 index 0000000..6a9b6ab Binary files /dev/null and b/contests/21-04-2022(Div.4)/B differ diff --git a/contests/21-04-2022(Div.4)/B.cpp b/contests/21-04-2022(Div.4)/B.cpp new file mode 100644 index 0000000..d1b3e98 --- /dev/null +++ b/contests/21-04-2022(Div.4)/B.cpp @@ -0,0 +1,30 @@ +#include + +using namespace std; + +auto solve(map 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 frq; + vector 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/contests/21-04-2022(Div.4)/E b/contests/21-04-2022(Div.4)/E new file mode 100755 index 0000000..0e57ed4 Binary files /dev/null and b/contests/21-04-2022(Div.4)/E differ diff --git a/contests/21-04-2022(Div.4)/E.cpp b/contests/21-04-2022(Div.4)/E.cpp new file mode 100644 index 0000000..7fac1a5 --- /dev/null +++ b/contests/21-04-2022(Div.4)/E.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main(){ + int tt, n, count; + cin >> tt; + while(tt--){ + string str; + cin >> n; + count = 0; + vector 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/contests/21-04-2022(Div.4)/F b/contests/21-04-2022(Div.4)/F new file mode 100755 index 0000000..b87fe94 Binary files /dev/null and b/contests/21-04-2022(Div.4)/F differ diff --git a/contests/21-04-2022(Div.4)/F.cpp b/contests/21-04-2022(Div.4)/F.cpp new file mode 100644 index 0000000..4ab1a8c --- /dev/null +++ b/contests/21-04-2022(Div.4)/F.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std; + +int main(){ + +} diff --git a/contests/Round#788/A(2_pointers).cpp b/contests/Round#788/A(2_pointers).cpp new file mode 100644 index 0000000..5d56719 --- /dev/null +++ b/contests/Round#788/A(2_pointers).cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +int main () { + int tt; + cin >> tt; + while (tt--) { + int n; + cin >> n; + vector v(n); + for(auto &x : v) { + cin >> x; + } + int l = 0, r = v.size() - 1; + while(r > l) { + while(v[l] < 0) { + l++; + } + while(v[r] > 0) { + r--; + } + if(l > r) break; + v[l] = -v[l]; + v[r] = -v[r]; + } + cout << (is_sorted(v.begin(), v.end()) ? "YES" : "NO"); + } +} + + diff --git a/contests/Round#788/A.cpp b/contests/Round#788/A.cpp new file mode 100644 index 0000000..ada8036 --- /dev/null +++ b/contests/Round#788/A.cpp @@ -0,0 +1,50 @@ +#include + +using namespace std; + +string solve(vector v) { + int p = 0; + int n = 0; + for(int i = 0; i < v.size(); i++) { + if(v[i] > 0) { + p++; + } + else{ + n++; + } + } + int loop = min(p, n); + int loop1 = loop; + for(int i = 0; i < v.size(); i++) { + if(v[i] > 0 && loop != 0) { + v[i] = -v[i]; + loop--; + } + } + loop = min(p, n); + for(int i = v.size() - 1; i > 0; i--) { + if(v[i] < 0 && loop1 != 0) { + v[i] = -v[i]; + loop1--; + } + } + if(is_sorted(v.begin(), v.end())) { + return "YES"; + } + return "NO"; +} + + +int main () { + int tt; + cin >> tt; + while (tt--) { + int n; + cin >> n; + vector v(n); + for(auto &x : v) { + cin >> x; + } + cout << solve(v) << endl; + } +} diff --git a/contests/Round#788/B.cpp b/contests/Round#788/B.cpp new file mode 100644 index 0000000..02b1493 --- /dev/null +++ b/contests/Round#788/B.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std; + +int main () { + +} diff --git a/contests/Round#788/C.cpp b/contests/Round#788/C.cpp new file mode 100644 index 0000000..f7133e4 --- /dev/null +++ b/contests/Round#788/C.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std + +int main () { + +} diff --git a/contests/Round#788/D.cpp b/contests/Round#788/D.cpp new file mode 100644 index 0000000..f7133e4 --- /dev/null +++ b/contests/Round#788/D.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std + +int main () { + +} diff --git a/contests/Round#788/E.cpp b/contests/Round#788/E.cpp new file mode 100644 index 0000000..f7133e4 --- /dev/null +++ b/contests/Round#788/E.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std + +int main () { + +} diff --git a/contests/Round#788/F.cpp b/contests/Round#788/F.cpp new file mode 100644 index 0000000..f7133e4 --- /dev/null +++ b/contests/Round#788/F.cpp @@ -0,0 +1,7 @@ +#include + +using namespace std + +int main () { + +} diff --git a/python/RecursiveDigitSum.py b/python/RecursiveDigitSum.py new file mode 100755 index 0000000..98a808d --- /dev/null +++ b/python/RecursiveDigitSum.py @@ -0,0 +1,15 @@ +#!/bin/env/python3 +x,n = map(int, input().split()) +x = str(x) +x = x * n +print(x) +def recursive_digit_sum(x): + y = 0 + if len(x) == 1: + return x; + else: + for i in x: + y += int(i) + print("y: ", y) + return recursive_digit_sum(str(y)) +print(recursive_digit_sum(x)) -- cgit v1.2.3