From 3d04c354dc6400021fe1b77c170c2984a1fcb00b Mon Sep 17 00:00:00 2001 From: "Paulo H. Lamounier" <53798700+Nanashii76@users.noreply.github.com> Date: Wed, 8 May 2024 19:33:08 -0300 Subject: [PATCH] c2ladders problems 800 --- Codeforces/800ranting/dislike_of_threes.cpp | 31 +++++++++++++++++++++ Codeforces/800ranting/fair_playoff.cpp | 31 +++++++++++++++++++++ Codeforces/800ranting/odd_set.cpp | 22 +++++++++++++++ Codeforces/800ranting/polycarp_coins.cpp | 22 +++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 Codeforces/800ranting/dislike_of_threes.cpp create mode 100644 Codeforces/800ranting/fair_playoff.cpp create mode 100644 Codeforces/800ranting/odd_set.cpp create mode 100644 Codeforces/800ranting/polycarp_coins.cpp diff --git a/Codeforces/800ranting/dislike_of_threes.cpp b/Codeforces/800ranting/dislike_of_threes.cpp new file mode 100644 index 0000000..338cfb0 --- /dev/null +++ b/Codeforces/800ranting/dislike_of_threes.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; + +const int MAX = 1e3+10; +vector sequence(MAX); + +void init_seq() { + + int aux = 1; + for(int i = 0; i < MAX; ++i) { + while(aux%3==0 or (aux%10)==3) + aux++; + sequence[i] = aux; + aux++; + } + +} + +int main(){ + + init_seq(); + int t; cin >> t; + while(t--) { + int a; cin >> a; + cout << sequence[a-1] << endl; + } + + return 0; + +} + diff --git a/Codeforces/800ranting/fair_playoff.cpp b/Codeforces/800ranting/fair_playoff.cpp new file mode 100644 index 0000000..b530eb6 --- /dev/null +++ b/Codeforces/800ranting/fair_playoff.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; + + +int main(){ + + int t; cin >> t; + while(t--) { + int bigger = 0, bigger2 = 0; + vector nums(4); + for(int i = 0; i < 4; ++i) { + cin >> nums[i]; + if(nums[i] >= bigger) { + int aux = bigger; + bigger = nums[i]; + bigger2 = aux; + } + + if(nums[i] != bigger and nums[i] > bigger2) + bigger2 = nums[i]; + } + + if((nums[0] == bigger and nums[1] == bigger2) or (nums[1] == bigger and nums[0] == bigger2) or (nums[2] == bigger and nums[3] == bigger2) or (nums[3] == bigger and nums[2] == bigger2)) + cout << "NO" << endl; + else + cout << "YES" << endl; + } + + return 0; + +} \ No newline at end of file diff --git a/Codeforces/800ranting/odd_set.cpp b/Codeforces/800ranting/odd_set.cpp new file mode 100644 index 0000000..cd762c0 --- /dev/null +++ b/Codeforces/800ranting/odd_set.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + + +int main(){ + + int n; cin >> n; + while(n--) { + int t; cin >> t; + int countEven = 0, countOdd = 0; + for(int i = 0; i < 2*t; i++) { + int num; cin >> num; + if(num&1) + countOdd++; + else + countEven++; + } + cout << (countEven==countOdd?"Yes":"No") << endl; + } + + return 0; +} \ No newline at end of file diff --git a/Codeforces/800ranting/polycarp_coins.cpp b/Codeforces/800ranting/polycarp_coins.cpp new file mode 100644 index 0000000..72ab5f5 --- /dev/null +++ b/Codeforces/800ranting/polycarp_coins.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + + +int main(){ + + int n; cin >>n; + while(n--) { + int t; cin >> t; + if(t%3) { + if(t/3+2*((t/3)+1) == t) + cout << t/3 << " " << t/3+1 << endl; + else + cout << t/3+1 << " " << t/3 << endl; + } else + cout << t/3 << " " << t/3 << endl; + } + + return 0; + + +} \ No newline at end of file