fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int N, i, tot;
  5. int x1, x2, y1, y2, dx, dy;
  6. scanf(" %d", &N);
  7. tot = 0;
  8. for (i = 0; i < N; i++) {
  9. scanf(" %d %d %d %d", &x1, &y1, &x2, &y2);
  10. dx = x2 - x1;
  11. dy = y2 - y1;
  12. tot += dx * dx + dy * dy;
  13. }
  14. printf("%d\n", tot);
  15. return 0;
  16. }
Success #stdin #stdout 0s 2172KB
stdin
5
0 0 0 0
1 3 1 3
4 10 11 10
2 2 3 3
0 1 0 1
stdout
51