Created
June 15, 2015 04:08
-
-
Save rogerioagjr/43188bdc9242600633d3 to your computer and use it in GitHub Desktop.
Insensibilidade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int n, resp; | |
int main(){ | |
// leio o valor de n | |
scanf("%d", &n); | |
// para cada uma das n linhas seguintes da entrada | |
for(int i=1; i<=n; i++){ | |
// declaro e leio os valores de x1, y1, x2 e y2 | |
int x1, y1, x2, y2; | |
scanf("%d %d %d %d", &x1, &y1, &x2, &y2); | |
// e somo em resp o quadrado da distância entre (x1, y1) e (x2, y2) | |
resp+=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); | |
} | |
// após a leitura da entrada, imprimo uma linha com o valor de resp | |
printf("%d\n", resp); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment