fork download
  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.*;
  4.  
  5. class Main {
  6.  
  7. public static void main(String[] args) throws IOException{
  8. Scanner sc = new Scanner(System.in);//new File("input.txt"));
  9. PrintWriter pw = new PrintWriter(System.out);//new File("output.txt"));
  10. int n = sc.nextInt();
  11. int a[][] = new int[1005][1005];
  12. int ans = 0;
  13. for (int i = 0; i < 1000; i++)
  14. for (int j = 0; j < 1000; j++)
  15. a[i][j] = 0;
  16. for (int i = 0; i < n; i++)
  17. {
  18. int x1 = sc.nextInt();
  19. int y1 = sc.nextInt();
  20. int x2 = sc.nextInt();
  21. int y2 = sc.nextInt();
  22. for (int j = x1; j <= x2; j++)
  23. for (int k = y1; k <= y2; k++)
  24. a[j][k]++;
  25. }
  26. for (int i = 0; i <= 100; i++)
  27. for (int j = 0; j <= 100; j++)
  28. ans += a[i][j];
  29. pw.println(ans);
  30. pw.close();
  31. }
  32. }
  33.  
Runtime error #stdin #stdout #stderr 0.1s 380608KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.util.NoSuchElementException
	at java.util.Scanner.throwFor(Scanner.java:907)
	at java.util.Scanner.next(Scanner.java:1530)
	at java.util.Scanner.nextInt(Scanner.java:2160)
	at java.util.Scanner.nextInt(Scanner.java:2119)
	at Main.main(Main.java:10)