直播系统定制开发,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画图相关的代码, 更多内容欢迎关注之后的文章