Skip to content

Commit 2ec27a0

Browse files
committed
Added New problems
1 parent 4602e17 commit 2ec27a0

File tree

14 files changed

+210
-0
lines changed

14 files changed

+210
-0
lines changed

CodeChef/PRICECON.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int main() {
6+
int tc;
7+
cin >> tc;
8+
9+
while (tc--) {
10+
int n;
11+
12+
string arr;
13+
cin >> arr;
14+
15+
n = arr.length();
16+
17+
int x = 0, y = 0, ans = 0;
18+
for (int i = 0; i < n; i++) {
19+
if (arr[i] == 'x')
20+
x++;
21+
if (arr[i] == 'y')
22+
y++;
23+
}
24+
while (x && y) {
25+
ans++;
26+
x--;
27+
y--;
28+
}
29+
30+
cout << ans << endl;
31+
}
32+
33+
return 0;
34+
}

CodeChef/a.out

1.73 KB
Binary file not shown.

CodeForces/New Folder/a.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int solve(int a, int b) {
6+
if (a == 0 || b == 0)
7+
return 0;
8+
int sh = 0, sw = 0, ans = 0;
9+
10+
if (a > b) {
11+
while (a > 1) {
12+
a -= 2;
13+
b -= 1;
14+
sh++;
15+
}
16+
} else {
17+
while (b > 1) {
18+
b -= 2;
19+
a -= 1;
20+
sw++;
21+
}
22+
}
23+
24+
return max(sh, sw);
25+
}
26+
int main() {
27+
int tc;
28+
cin >> tc;
29+
30+
while (tc--) {
31+
int a, b;
32+
cin >> a >> b;
33+
34+
int ans = solve(a, b);
35+
36+
cout << ans << endl;
37+
}
38+
return 0;
39+
}

CodeForces/New Folder/a.out

15.4 KB
Binary file not shown.

CodeForces/a.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
6+
int tc;
7+
8+
cin >> tc;
9+
10+
while (tc--) {
11+
int n;
12+
cin >> n >> k;
13+
}
14+
}

CodeForces/a.out

15.4 KB
Binary file not shown.

CodeForces/practice/Dminopiling.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
int main() {
4+
int a, b;
5+
cin >> a >> b;
6+
cout << ((a * b) / 2) << endl;
7+
return 0;
8+
}

CodeForces/practice/NextRound.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int main() {
6+
int n, k;
7+
8+
cin >> n >> k;
9+
10+
int arr[51];
11+
12+
for (int i = 0; i < n; i++)
13+
cin >> arr[i];
14+
15+
int ans = 0;
16+
17+
for (int i = 0; i < n; i++) {
18+
if (arr[i] && arr[k - 1] <= arr[i])
19+
ans++;
20+
}
21+
22+
cout << ans << endl;
23+
24+
return 0;
25+
}

CodeForces/practice/StringTask.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int main() {
6+
char s;
7+
while (cin >> s)
8+
if (!strchr("AEIOUYaeiouy", s))
9+
cout << '.' << (char)tolower(s);
10+
11+
return 0;
12+
}

CodeForces/practice/Team.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int main() {
6+
int tc;
7+
8+
cin >> tc;
9+
int a, b, c, ans = 0;
10+
for (int i = 0; i < tc; i++) {
11+
cin >> a >> b >> c;
12+
13+
if ((a && b) || (a && c) || (b && c))
14+
ans++;
15+
}
16+
17+
cout << ans << endl;
18+
return 0;
19+
}

0 commit comments

Comments
 (0)