Skip to content

Instantly share code, notes, and snippets.

/1578.cpp Secret

Created Aug 18, 2014
Embed
What would you like to do?
#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