Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Created June 15, 2015 04:08
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 rogerioagjr/43188bdc9242600633d3 to your computer and use it in GitHub Desktop.
Save rogerioagjr/43188bdc9242600633d3 to your computer and use it in GitHub Desktop.
Insensibilidade
#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