Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Source: https://usaco.guide/general/io
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int v[n][n];
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- cin >> v[i][j];
- }
- }
- int linha, coluna;
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- if(v[i][j]==0){
- linha=i;
- coluna=j;
- }
- }
- }
- int soma=0, soma_magica=0;
- for(int j=0; j<n; j++){
- soma = soma + v[linha][j];
- }
- if(linha!=0){
- for(int j=0; j<n; j++){
- soma_magica = soma_magica + v[0][j];
- }
- }
- else{
- for(int j=0; j<n; j++){
- soma_magica = soma_magica + v[1][j];
- }
- }
- cout << soma_magica-soma << endl;
- cout << linha+1 << endl;
- cout << coluna+1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement