We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89ab086 commit 09df749Copy full SHA for 09df749
Practice/Codeforces/Perfect Team-1221C.cpp
@@ -0,0 +1,29 @@
1
+//Problem Link : https://codeforces.com/problemset/problem/1221/C
2
+
3
+#include<bits/stdc++.h>
4
+using namespace std;
5
+typedef long long ll;
6
+int main()
7
+{
8
+ ll q;
9
+ cin>>q;
10
+ while(q--)
11
+ {
12
+ ll c,m,x,d;
13
+ cin>>c>>m>>x;
14
+ if(c<=x||m<=x||c==0||m==0)
15
16
+ cout<<min(c,m)<<endl;
17
+ }
18
+ else
19
20
+ c=c-x;m=m-x;
21
+ if((c+m)/3>min(c,m))
22
+ x=x+min(c,m);
23
24
+ x=x+(c+m)/3;
25
+ cout<<x<<endl;
26
27
28
+ return 0;
29
+}
0 commit comments