From a342d1d04dd0bbc79f004435ae9ba5f2a1e1bc2c Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Tue, 21 Dec 2021 21:54:41 +0100 Subject: [PATCH] Tried my first real codeforces round, got stuck way too long on one of the earlier questions, but over all, you gotta start somewhere i guess --- codeforces/rounds/762/a.cpp | 36 +++++++++++++++++++ codeforces/rounds/762/b.cpp | 50 ++++++++++++++++++++++++++ codeforces/rounds/762/c.cpp | 72 +++++++++++++++++++++++++++++++++++++ codeforces/rounds/762/d.cpp | 42 ++++++++++++++++++++++ codeforces/rounds/762/e.cpp | 25 +++++++++++++ codeforces/rounds/762/f.cpp | 25 +++++++++++++ codeforces/rounds/762/g.cpp | 25 +++++++++++++ codeforces/rounds/762/h.cpp | 25 +++++++++++++ 8 files changed, 300 insertions(+) create mode 100644 codeforces/rounds/762/a.cpp create mode 100644 codeforces/rounds/762/b.cpp create mode 100644 codeforces/rounds/762/c.cpp create mode 100644 codeforces/rounds/762/d.cpp create mode 100644 codeforces/rounds/762/e.cpp create mode 100644 codeforces/rounds/762/f.cpp create mode 100644 codeforces/rounds/762/g.cpp create mode 100644 codeforces/rounds/762/h.cpp diff --git a/codeforces/rounds/762/a.cpp b/codeforces/rounds/762/a.cpp new file mode 100644 index 0000000..dacfc7b --- /dev/null +++ b/codeforces/rounds/762/a.cpp @@ -0,0 +1,36 @@ +#include + +using namespace std; + +void test_case(int tc){ + string s; + cin >> s; + + for(size_t i = 0; i < (s.size() + 1) / 2; ++i){ + if(s[i] != s[i + (s.size() + 1) / 2]){ + cout << "NO\n"; + return; + } + } + + cout << "YES\n"; + return; +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/b.cpp b/codeforces/rounds/762/b.cpp new file mode 100644 index 0000000..3fc824b --- /dev/null +++ b/codeforces/rounds/762/b.cpp @@ -0,0 +1,50 @@ +#include + +using namespace std; + +int N_MAX = 1e9; + + +void test_case(int tc){ + int n; + cin >> n; + + set valids; + int i = 1; + int r = pow(i, 2); + while(r <= n){ + valids.insert(r); + + i++; + r = pow(i, 2); + } + + i = 1; + r = pow(i, 3); + while(r <= n){ + valids.insert(r); + + i++; + r = pow(i, 3); + } + + cout << valids.size() << '\n'; +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/c.cpp b/codeforces/rounds/762/c.cpp new file mode 100644 index 0000000..e3194cf --- /dev/null +++ b/codeforces/rounds/762/c.cpp @@ -0,0 +1,72 @@ +#include + +using namespace std; + +typedef long long ll; + +int first_digit(ll& n){ + int digits = (int)log10(n); + + n = (int)(n / pow(10, digits)); + + return n; +} + +void test_case(int tc){ + ll a, s; + cin >> a >> s; + + ll b = 0; + int bpow = 0; + + while(a > 0){ + if(s == 0){ + cout << -1 << '\n'; + return; + } + + int la = a % 10, ls = s % 10; + if(ls < la){ + ls = s % 100; + s /= 10; + } + + if(ls - la > 9 || la > ls){ + cout << -1 << '\n'; + return; + } + + a /= 10; + s /= 10; + + b += (ll)pow(10, bpow) * (ls - la); + bpow++; + } + + while(s > 0){ + b += (ll)pow(10, bpow) * (s % 10); + s /= 10; + bpow++; + } + + cout << b << '\n'; + return; +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/d.cpp b/codeforces/rounds/762/d.cpp new file mode 100644 index 0000000..745109f --- /dev/null +++ b/codeforces/rounds/762/d.cpp @@ -0,0 +1,42 @@ +#include + +using namespace std; + +void test_case(int tc){ + int m, n; + cin >> m >> n; + + vector> joys(m); + vector second_worsts(n); + + for(int i = 0; i < m; ++i){ + for(int j = 0; j < n; ++j){ + int ij; + cin >> ij; + // cin >> joys[i][j]; + joys[i].push_back(ij); + } + } + + int result = 0; + cout << result << '\n'; + return; +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/e.cpp b/codeforces/rounds/762/e.cpp new file mode 100644 index 0000000..0c03bec --- /dev/null +++ b/codeforces/rounds/762/e.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +void test_case(int tc){ + +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/f.cpp b/codeforces/rounds/762/f.cpp new file mode 100644 index 0000000..0c03bec --- /dev/null +++ b/codeforces/rounds/762/f.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +void test_case(int tc){ + +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/g.cpp b/codeforces/rounds/762/g.cpp new file mode 100644 index 0000000..0c03bec --- /dev/null +++ b/codeforces/rounds/762/g.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +void test_case(int tc){ + +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file diff --git a/codeforces/rounds/762/h.cpp b/codeforces/rounds/762/h.cpp new file mode 100644 index 0000000..0c03bec --- /dev/null +++ b/codeforces/rounds/762/h.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +void test_case(int tc){ + +} + + + +int main(){ + ios::sync_with_stdio(0); + cin.tie(0); + + int t; + cin >> t; + + for(int tc = 1; tc <= t; ++tc){ + test_case(tc); + } + + cout << flush; + + return 0; +} \ No newline at end of file