Skip to content

Commit 1543cf5

Browse files
committed
new one
1 parent a523606 commit 1543cf5

File tree

3 files changed

+77
-2
lines changed

3 files changed

+77
-2
lines changed

even_odds.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include<iostream>
2+
using namespace std;
3+
int main()
4+
{
5+
long long int n, k, result;
6+
cin >> n >> k;
7+
if (n % 2 == 0)
8+
{
9+
if (k <= n / 2)
10+
result = 1 + 2 * (k - 1);
11+
else
12+
{
13+
result = 2 + 2 * (k - n / 2 - 1);
14+
}
15+
}
16+
else
17+
{
18+
if (k <= (n + 1) / 2)
19+
result = 1 + 2 * (k - 1);
20+
else
21+
{
22+
result = 2 + 2 * (k - (n + 1) / 2 - 1);
23+
}
24+
}
25+
cout << result << endl;
26+
}

i_wanna_be_the_guy.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
class ved
4+
{
5+
int n, p, q;
6+
7+
public:
8+
void input()
9+
{
10+
cin >> n;
11+
cin >> p;
12+
int a[p];
13+
for (int i = 0; i < p; i++)
14+
cin >> a[i];
15+
cin >> q;
16+
int b[q];
17+
for (int i = 0; i < q; i++)
18+
cin >> b[i];
19+
result(a, b);
20+
}
21+
void result(int a[], int b[])
22+
{
23+
int count = 0;
24+
int check[n + 1] = {0};
25+
for (int i = 0; i < p; i++)
26+
check[a[i]] += 1;
27+
for (int i = 0; i < q; i++)
28+
check[b[i]] += 1;
29+
for (int i = 0; i < n + 1; i++)
30+
{
31+
if (check[i] != 0)
32+
count += 1;
33+
}
34+
if (count == n)
35+
cout << "I become the guy." << endl;
36+
else
37+
cout << "Oh, my keyboard!" << endl;
38+
}
39+
};
40+
int main()
41+
{
42+
ios::sync_with_stdio(false);
43+
cin.tie(0);
44+
ved ob;
45+
ob.input();
46+
return 0;
47+
}

tempCodeRunnerFile.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
else
2-
cout<<"NO"<<endl;
1+
2+
cout << "Oh, my keyboard!" << endl;
3+
}
4+
};

0 commit comments

Comments
 (0)