-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagico.cpp
executable file
·49 lines (42 loc) · 1004 Bytes
/
magico.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
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
lli N;
cin >> N;
lli quadrado[N][N];
lli ansColuna;
lli ansLinha;
bool achou = false;
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
lli temp;
cin >> temp;
quadrado[i][j] = temp;
if(temp == 0){
ansLinha = i;
ansColuna = j;
}
}
}
lli somaLinhaErrada = 0;
for(int j = 0; j < N; j++){
somaLinhaErrada += quadrado[ansLinha][j];
}
lli somaLinha = 0;
for(int i = 0; i < N; i++){
if(i != ansLinha){
for(int j = 0; j < N; j++){
somaLinha += quadrado[i][j];
}
break;
}
}
cout << somaLinha - somaLinhaErrada << endl;
cout << ansLinha +1<< endl;
cout << ansColuna +1<< endl;
return 0;
}