Skip to content

Commit cd62edd

Browse files
committed
did some flashcards and a contest on the ccc grader for pratice
1 parent 40e44ab commit cd62edd

File tree

7 files changed

+420
-292
lines changed

7 files changed

+420
-292
lines changed

Contests/CCC Contests/flipper.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
/******************************************
6+
Link:
7+
Points:
8+
******************************************/
9+
10+
void flipper()
11+
{
12+
string input;
13+
cin >> input;
14+
15+
vector<vector<int>> grid = {{1, 2}, {3, 4}};
16+
17+
for (int i = 0; i < input.size(); ++i)
18+
{
19+
if (input[i] == 'H')
20+
{
21+
swap(grid[0][0], grid[1][0]);
22+
swap(grid[0][1], grid[1][1]);
23+
}
24+
else
25+
{
26+
swap(grid[0][0], grid[0][1]);
27+
swap(grid[1][0], grid[1][1]);
28+
}
29+
}
30+
31+
for (int i = 0; i < 2; ++i)
32+
{
33+
for (int j = 0; j < 2; ++j)
34+
printf("%d ", grid[i][j]);
35+
printf("\n");
36+
}
37+
}
38+
39+
int main()
40+
{
41+
flipper();
42+
return 0;
43+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
/******************************************
6+
Link:
7+
Points:
8+
******************************************/
9+
10+
bool isPrime(int x)
11+
{
12+
for (int i = 2; i * i <= x; ++i)
13+
if (x % i == 0)
14+
return false;
15+
return true;
16+
}
17+
18+
void prettyAveragePrimes()
19+
{
20+
int T, N;
21+
scanf("%d", &T);
22+
23+
vector<int> primes;
24+
for (int i = 0; i < T; ++i)
25+
{
26+
scanf("%d", &N);
27+
N *= 2;
28+
for (int j = 2; j <= N / 2; ++j)
29+
{
30+
bool leftPrime = isPrime(j);
31+
bool rightPrime = isPrime(N - j);
32+
33+
if (leftPrime && rightPrime)
34+
{
35+
printf("%d %d\n", j, N - j);
36+
break;
37+
}
38+
}
39+
}
40+
}
41+
42+
int main()
43+
{
44+
prettyAveragePrimes();
45+
return 0;
46+
}
-68.1 KB
Binary file not shown.

Solutions/DMOJ Solutions/S3/optimalSplitPoint.cpp

Lines changed: 0 additions & 83 deletions
This file was deleted.

anki

-449 KB
Binary file not shown.

0 commit comments

Comments
 (0)