-
Notifications
You must be signed in to change notification settings - Fork 1
/
cubomagico.cpp
55 lines (47 loc) · 1.08 KB
/
cubomagico.cpp
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
53
54
#include <bits/stdc++.h>
int main(){
std::ios_base::sync_with_stdio(false);
int input;
scanf("%d", &input);
int cube[input][input];
int index;
int sum = 0;
int s1 = false;
int o = 0;
int zero[1][2];
bool s = false;
for(int i = 0; i < input; i++){
for(int j = 0; j < input; j++){
scanf("%d", &cube[i][j]);
if(cube[i][j] == 0){
index = i;
zero[0][0] = i;
zero[0][1] = j;
}
}
}
for(int i = 0; i < input; i++){
for(int j = 0; j < input; j++){
if(i != index){
sum += cube[i][j];
s1 = true;
}else{
o += cube[i][j];
s = true;
}
}
if(s && s1){
break;
}else if(s1 && !s){
sum = 0;
s1 = false;
continue;
}else{
continue;
}
}
printf("%d\n", sum - o);
printf("%d\n", zero[0][0] + 1);
printf("%d\n", zero[0][1] + 1);
return 0;
}