-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_Loop_FC_22.cpp
More file actions
52 lines (52 loc) · 1.15 KB
/
Copy path03_Loop_FC_22.cpp
File metadata and controls
52 lines (52 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
if(n%2!=0){
int sum_a=0,sum_b=0,sum_c=0,m=0;
while(m<k){
int a,b,c;
cin >> a >> b >> c;
if(a==b){
if(a==b & b==c){
if(a+b>k){
sum_a++;
sum_b=sum_b+2;
sum_c=sum_c-3;
}
else{
sum_a=sum_a-3;
sum_b=sum_b-2;
sum_c++;
}
} else{
sum_a=sum_a+2;
sum_b=sum_b-3;
}
}
m++;
}
cout << sum_a << " " << sum_b << " " << sum_c;
}else{
int s,t;
cin >> s >> t;
int x=s, y=t;
if(s>t){
x=s-t;
}
else{
if(s<t){
y=2*(t-s);
}
}
if(x+y>k){
int temp=x;
x=y;
y=temp;
x=y+pow(s,2);
}
cout << x << " " << y;
}
return 0;
}