Skip to content

Instantly share code, notes, and snippets.

/1578.cpp Secret

Created August 18, 2014 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9afab04ee3c3506f65b1 to your computer and use it in GitHub Desktop.
Save anonymous/9afab04ee3c3506f65b1 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
unsigned char N, M, I = 4, A, B, Maior[20] = {0};
unsigned long long int V[20][20];
inline void clear(){
for(A = 0; A < M; A++)
Maior[A] ^= Maior[A];
}
int main(){
scanf("%hhd", &N);
for(; N > 0; N--){
scanf("%hhd", &M);
for(A = 0; A < M; A++){
for(B = 0; B < M; B++){
scanf("%llu", &V[A][B]);
V[A][B] *= V[A][B];
if(V[Maior[B]][B] < V[A][B]) Maior[B] = A;
}
}
for(A = 0; A < M; A++)
Maior[A] = V[Maior[A]][A] > 0 ? (int) log10 ((double) V[Maior[A]][A]) + 1 : 1;
printf("Quadrado da matriz #%hhd:\n", I++);
for(A = 0; A < M; A++){
for(B = 0; B < M; B++){
printf("%*llu ", (int)Maior[B], V[A][B] );
}
printf("\n");
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment