)
题解5数组工艺品制作、彩票摇奖工艺品制作题解import java.util.Scanner; public class Main09021 { //程序主入口 public static void main(String[] args) { Scanner scnew Scanner(System.in); //输入读取长宽高w、x、h int wsc.nextInt(); int xsc.nextInt(); int hsc.nextInt(); //输入读取切割次数q int qsc.nextInt(); //将坐标数据存入三维数组flag[t][j][k] //true表示该编号的小方块已被蒸发 //由题意方块的标号从1开始故数组的长度1舍弃0下标 boolean [][][]flagnew boolean[w1][x1][h1]; for(int i0;iq;i){ int x1sc.nextInt(); int y1sc.nextInt(); int z1sc.nextInt(); int x2sc.nextInt(); int y2sc.nextInt(); int z2sc.nextInt(); //遍历三维数组将符合条件的小方块编号为true for (int tx1;tx2;t){//遍历x方向 for (int jy1;jy2;j){//遍历y方向 for (int kz1;kz2;k){//遍历z方向 flag[t][j][k]true; } } } } int remain0;//设置计数器用来表示剩余的方块数 //遍历全部存在的小方块编号 for (int t1;tw;t){ for (int j1;jx;j){ for (int k1;kh;k){ //flag[t][j][k]表示未被蒸发的小正方体被标记为false if(!flag[t][j][k]){ remain; } } } } //打印输出剩余的小正方体个数 System.out.println(remain); sc.close(); } }输出结果彩票摇奖题解package Luogu; import java.util.Scanner; /** * author jinhong * date 2026/9/3 21:42 * description 彩票摇奖 */ public class Main { //程序主入口 public static void main(String[] args) { Scanner sc new Scanner(System.in); //输入购入的彩票张数n int n sc.nextInt(); //将中奖的号码存入isWin数组中设置长度为34 boolean[] isWin new boolean[34]; //在第二行输入中奖号码并标记中奖号码为true for (int i 0; i 7; i) { int num sc.nextInt(); isWin[num] true; } //定义win[0]为特等奖win[1]为一等奖...以此类推 //定义长度为7的数组用来存放输入的7个数据 int[] win new int[7]; //依据n控制第二行以后输入的数据行数为n for (int t 0; t n; t) { //设置计数器记录每张彩票中奖号码的个数 int count 0; //输入每张彩票中的号码并依次遍历每张彩票中的号码 for (int i 0; i 7; i) { int x sc.nextInt(); //如果彩票中的号码与事先存入数组的中奖的号码相等 if (isWin[x]) { //个数1 count; } } //由题可知由于输出时从最左侧到最右侧代表特等下标0一等下标1...每张彩票中需要与中奖号码相等 // 的个数为7、6、5、4、3、2、1 //因此打印出的数据的下标index应为每行输入数字个数7-每张彩票中需要与中奖号码相等的个数count if (count 1) { int index 7 - count; //下标1打印下一个数据 win[index]; } } //遍历输出中奖张数 for (int i 0; i 7; i) { System.out.print(win[i] ); } } }输出结果