美文网首页
CCF201409-2 画图(JAVA)

CCF201409-2 画图(JAVA)

作者: 巨鹿lx | 来源:发表于2020-03-21 11:55 被阅读0次
    import java.util.Scanner;
    
    public class Main{
        static int N = 105;
        static int a[][] = new int[N][N];
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
            while(n-->0) {
                int x1 = scanner.nextInt();
                int y1 = scanner.nextInt();
                int x2 = scanner.nextInt();
                int y2 = scanner.nextInt();
                for(int i = x1; i < x2; i ++) {
                    for(int j = y1; j < y2; j++) {
                        a[i][j] = 1;
                    }
                }
            }
            int res = 0;
            for(int i = 0 ; i < 100; i ++) {
                for(int j = 0 ; j < 100; j ++) {
                    if(a[i][j]==1) res++;
                }
            }
            System.out.println(res);
        }   
    }
    

    相关文章

      网友评论

          本文标题:CCF201409-2 画图(JAVA)

          本文链接:https://www.haomeiwen.com/subject/qkdyyhtx.html