Skip to content

Commit

Permalink
c2ladders problems 800
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanashii76 authored May 8, 2024
1 parent 419e908 commit 3d04c35
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Codeforces/800ranting/dislike_of_threes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e3+10;
vector<int> 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;

}

31 changes: 31 additions & 0 deletions Codeforces/800ranting/fair_playoff.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <bits/stdc++.h>
using namespace std;


int main(){

int t; cin >> t;
while(t--) {
int bigger = 0, bigger2 = 0;
vector<int> 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;

}
22 changes: 22 additions & 0 deletions Codeforces/800ranting/odd_set.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <bits/stdc++.h>
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;
}
22 changes: 22 additions & 0 deletions Codeforces/800ranting/polycarp_coins.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <bits/stdc++.h>
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;


}

0 comments on commit 3d04c35

Please sign in to comment.