天天看點

直播系統定制開發,Java畫圖

直播系統定制開發,java畫圖相關的代碼

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/*
 *把每一個方塊都看成點 
 */

public class Main2 {
    public static void main(String[] args) {
        // TODO wAuto-generated method stub
        Scanner scanner = new Scanner(System.in);

        int[][] matrix = new int[101][101];

        int n = scanner.nextInt();

        int[][] a = new int[n][4];

        //輸入
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[0].length; j++) {
                a[i][j] = scanner.nextInt();
            }
        }

        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[0].length; j++) {
                matrix[i][j] = 0;
            }
        }

        for (int k = 0; k < n; k++) {
            for (int i = a[k][0]; i < a[k][2]; i++) {
                for (int j = a[k][1]; j < a[k][3]; j++) {
                    matrix[i][j] = 1;
                }
            }
        }

        int count = 0;
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[0].length; j++) {
                if(matrix[i][j]==1){
                    count++;
                }
            }
        }

        System.out.println(count);
    }
}
           

以上就是直播系統定制開發,java畫圖相關的代碼, 更多内容歡迎關注之後的文章