【蓝桥杯省赛】冲刺练习题【经典题目练习】倒计时【01】天(准考证组委会已下发,请查询)

  ??距离【第十三届蓝桥杯4月9日省赛】仅剩【01天】??

?今日题型:【第十二届省赛2套题】?

⭐️?循环是一切暴力的基础,暴力基础,转起来。?⭐️

?国一镇楼?

?比赛题目与分数比例?

确认范围:

结果填空题5道,共计45分。

程序设计题5道,共计105分。

⭐️?刷题安排?⭐️

日期 题目类型 题目数量
3月25日 循环 6
3月26日 超大数 6
3月27日 数组 6
3月28日 枚举 6
3月29日 递归 6
3月30日 绘图 6
3月31日 深搜广搜 5
4月1日 动态规划 5
4月2日 填空题 5
4月3日

数学公式:查询准考证

点击查询准考证链接

5
4月4日 第十届省赛题 10
4月5日 第十一届省赛题 10
4月6日 第十二届省赛1套题 10
4月7日 第十二届省赛2套题 10
4月8日 经典题目练习 8
4月9日 9点考试

1、Api运用题(日历Calendar)

题目:有邪教称1999年12月31日是世界末日,当然谣言已经不攻自破。还有人称今后的某个世纪末的12月31日,如果是星期一则会…有趣的是,任何一个世纪末的年份的12月31日都不可能是星期一!!!于是"谣言制造商"又修改为星期日…

1999年12月31日是星期五,请问:未来哪一个离我们最近的一个世纪末年(即XX99年)的12月31日正好是星期天(即星期日)?
回答年份即可

package action;

import java.util.Calendar;

public class demo3 {
	public static void main(String[] args) {
		Calendar calendar = Calendar.getInstance();
		for (int i = 1999; i < 10000; i += 100) {
			calendar.set(Calendar.YEAR, i);
			calendar.set(Calendar.MONTH, 11);
			calendar.set(Calendar.DATE, 31);
			if (calendar.get(Calendar.DAY_OF_WEEK) == 1) {
				System.out.println(i);
				break;
			}
		}
	}
}

2、星辰大海

最新的火星探测机器人curiosity被困在了一个二维迷宫里,迷宫由一个个方格组成。
  共有四种方格:
  ‘.’ 代表空地,curiosity可以穿过它
  ‘#’ 代表障碍物,不可穿越,不可停留
  ‘S’ 代表curiosity的起始位置
  ‘T’ 代表curiosity的目的地
  NASA将会发送一系列的命令给curiosity,格式如下:“LRUD”分别代表向左,向右,向上,向下走一步。由于地球和火星之间最近时也有55000000km!所以我们必须提前判断这一系列的指令会让curiosity最终处在什么样的状态,请编程完成它。

输入格式

  第一行是一个整数T,代表有几个测试样例
  每个测试样例第一行是一个整数N(1<=N<=50))代表迷宫的大小(N*N)。随后的N行每行由N个字符串组成,代表迷宫。接下来的一行是一个整数Q,代表有多少次询问,接下来的Q行每行是一个仅由“LRUD”四个字母的组成的字符串,字符转长度小于1000.

输出格式

  对于每个询问输出单独的一行:
  “I get there!”:执行给出的命令后curiosity最终到达了终点。
  “I have no idea!”:执行给出的命令后curiosity未能到达终点。
  “I am dizzy!”:curiosity在执行命令的过程中撞到了障碍物。
  “I am out!”:代表curiosity在执行命令的过程中走出了迷宫的边界。
输入示例:

2
2
S.
#T
2
RD
DR
3
S.#
.#.
.T#
3
RL
DDD
DDRR

输出示例:

I get there!
I am dizzy!
I have no idea!
I am out!
I get there!

我的这个写法动脑少一些,推荐用搜索的方式编写。

package action;
import java.util.Scanner;

public class demo3 {
	static Scanner sc = new Scanner(System.in);
 
	public static void main(String[] args) {
		String[] arr = new String[999];
		int scount = 0;
 
		int a = sc.nextInt();
		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			char[][] bb = new char[b][b];
			for (int j = 0; j < b; j++) {
				bb[j] = sc.next().toCharArray();
 
			}
 
			int c = sc.nextInt();
			String[] cc = new String[c];
			for (int j = 0; j < cc.length; j++) {
				cc[j] = sc.next();
			}
			char[][] ccc = new char[c][1000];
 
			for (int j = 0; j < c; j++) {
				for (int j2 = 0; j2 < cc[j].length(); j2++) {
					ccc[j][j2] = cc[j].charAt(j2);
				}
			}
 
			for (int j = 0; j < c; j++) {
				int h = 0;
				int s = 0;
				zb: for (int j2 = 0; j2 < 1000; j2++) {
					zc: for (int k = 0; k < b; k++) {
						for (int k2 = 0; k2 < b; k2++) {
							if (j2 == 0 && bb[k][k2] == 'S') {
								h = k2;
								s = k;
								break zc;
							}
						}
					}
					if (ccc[j][j2] >= 'A' & ccc[j][j2] <= 'Z') {
						if (ccc[j][j2] == 'L') {
							h--;
							if (s < 0 | s == b | h < 0 | h == b) {
								arr[scount++] = "走出了迷宫的边界!";
								break zb;
							} else if (bb[s][h] == '#') {
								arr[scount++] = "执行命令的过程中撞到了障碍物导致眩晕!";
								break zb;
							} else if (bb[s][h] == 'T') {
								arr[scount++] = "抵达终点!";
								break zb;
							}
						} else if (ccc[j][j2] == 'R') {
							h++;
							if (s < 0 | s == b | h < 0 | h == b) {
								arr[scount++] = "走出了迷宫的边界!";
								break zb;
							} else if (bb[s][h] == '#') {
								arr[scount++] = "执行命令的过程中撞到了障碍物导致眩晕!";
								break zb;
							} else if (bb[s][h] == 'T') {
								arr[scount++] = "抵达终点!";
								break zb;
							}
						} else if (ccc[j][j2] == 'U') {
							s--;
							if (s < 0 | s == b | h < 0 | h == b) {
								arr[scount++] = "走出了迷宫的边界!";
								break zb;
							} else if (bb[s][h] == '#') {
								arr[scount++] = "执行命令的过程中撞到了障碍物导致眩晕!";
								break zb;
							} else if (bb[s][h] == 'T') {
								arr[scount++] = "抵达终点!";
								break zb;
							}
						} else if (ccc[j][j2] == 'D') {
							s++;
							if (s < 0 | s == b | h < 0 | h == b) {
								arr[scount++] = "走出了迷宫的边界!";
								break zb;
							} else if (bb[s][h] == '#') {
								arr[scount++] = "执行命令的过程中撞到了障碍物导致眩晕!";
								break zb;
							} else if (bb[s][h] == 'T') {
								arr[scount++] = "抵达终点!";
								break zb;
							}
						}
 
					} else {
						arr[scount++] = "老师付也不知道路了啊,游戏结束!";
						break zb;
					}
 
				}
			}
		}
		for (int i = 0; i < scount; i++) {
			System.out.println(arr[i]);
		}
	}
 
}

写一个【2048】·强化处理边缘值(虽然不难,代码多,相当于6个题)

package action;

import java.io.IOException;
import java.util.*;

/**
 * java控制台2048 2022年4月3日09:35:17
 * 上W左A下S右D
 */
public class demo {

	public static final int X = 4;
	public static final int Y = 4;
	public static int model[][] = new int[X][Y];
	public static int step = 0;
	public static boolean gameover = false;
	public static int enumM[] = { 2, 2, 2, 2, 4, 4, 4, 8 };
	public static void main(String[] args){
		Random ra=new Random();
		int randomX, randomY;
		randomX = ra.nextInt(X);
		randomY = ra.nextInt(model[randomX].length);
		model[randomX][randomY] = 2;

		randomX = ra.nextInt(X);
		randomY = ra.nextInt(model[randomX].length);
		model[randomX][randomY] = 2;

		randomX = ra.nextInt(X);
		randomY = ra.nextInt(model[randomX].length);
		model[randomX][randomY] = 4;
		randomX = ra.nextInt(X);
		randomY = ra.nextInt(model[randomX].length);
		model[randomX][randomY] = 2048;

		outPrint();
		while (!gameover) {
			int read;
			try {
				read = System.in.read();
				change(read);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	public static void outPrint() {
		for (int i = 0; i < X; i++) {
			for (int j = 0; j < Y; j++) {
				System.out.print("【");
				if (model[i][j] == 0) {
					System.out.print("    ");
				}
				if (model[i][j] > 0 && model[i][j] < 9) {
					System.out.print("  " + model[i][j] + " ");
				}
				if (model[i][j] > 9 && model[i][j] < 100) {
					System.out.print(" " + model[i][j] + " ");
				}
				if (model[i][j] > 99 && model[i][j] < 1000) {
					System.out.print(" " + model[i][j]);
				}
				if (model[i][j] > 999) {
					System.out.print(model[i][j]);
				}
				System.out.print("】");
			}
			System.out.println();
		}
	}

	public static void change(int dir) {
		switch (dir) {
		case 115:// S 下
			int[] xp4 = new int[Y];
			for (int i = 0; i < Y; i++) {
				boolean goon = true;
				while (goon) {
					int[] temp = new int[X];
					int tempIdex = X - 1;
					for (int j = X - 1; j >= 0; j--) {
						if (model[j][i] != 0) {
							temp[tempIdex--] = model[j][i];
						}
					}
					boolean hv = false;
					for (int j = X - 1; j > 0; j--) {
						if (temp[j] == temp[j - 1] && temp[j] != 0) {
							temp[j] = temp[j] * 2;
							temp[j - 1] = 0;
							hv = true;
						}
					}
					goon = hv;
					int is0 = 0;
					for (int j = X - 1; j >= 0; j--) {
						model[j][i] = temp[j];
						if (temp[j] == 0)
							is0++;
					}
					if (is0 > 0) {
						xp4[i] = 1;// 可插牌
					}
				}
			}
			// 插牌
			List<Integer> space4 = new ArrayList<Integer>();
			for (int j = 0; j < xp4.length; j++) {
				if (xp4[j] == 1) {
					space4.add(j);
				}
			}
			if (space4.size() == 0) {
				gameover = true;
				System.out.println("game over");
				System.exit(0);
			} else {
				int a = (int) (Math.random() * (space4.size()));
				Integer index = space4.get(a);
				for (int j = X - 1; j >= 0; j--) {
					if (model[j][index] == 0) {
						model[j][index] = enumM[(int) (Math.random() * enumM.length)];
						break;
					}
				}
			}
			outPrint();
			break;
		case 100:// D 右
			int[] xp = new int[X];
			for (int i = 0; i < X; i++) {
				boolean goon = true;
				while (goon) {
					int[] temp = new int[Y];
					int tempIdex = Y - 1;
					// 去空
					for (int j = Y - 1; j >= 0; j--) {
						if (model[i][j] != 0) {
							temp[tempIdex--] = model[i][j];
						}
					}
					boolean hv = false;
					// 合并
					for (int j = 0; j < Y - 1; j++) {
						if (temp[j] == temp[j + 1] && temp[j] != 0) {
							temp[j] = temp[j] * 2;
							temp[j + 1] = 0;
							hv = true;
						}
					}
					goon = hv;
					int is0 = 0;
					for (int j = 0; j < Y; j++) {
						model[i][j] = temp[j];
						if (temp[j] == 0)
							is0++;
					}
					if (is0 > 0) {
						xp[i] = 1;// 可插牌
					}
				}
			}
			// 插牌
			List<Integer> space = new ArrayList<Integer>();
			for (int j = 0; j < xp.length; j++) {
				if (xp[j] == 1) {
					space.add(j);
				}
			}
			if (space.size() == 0) {
				gameover = true;
				System.out.println("game over");
				System.exit(0);
			} else {
				int a = (int) (Math.random() * (space.size()));
				Integer index = space.get(a);
				for (int j = Y - 1; j >= 0; j--) {
					if (model[index][j] == 0) {
						model[index][j] = enumM[(int) (Math.random() * enumM.length)];
						break;
					}
				}
			}
			outPrint();
			break;
		case 119:// W 上
			int[] xp3 = new int[Y];
			for (int i = 0; i < Y; i++) {
				boolean goon = true;
				while (goon) {
					int[] temp = new int[X];
					int tempIdex = 0;
					for (int j = 0; j < X; j++) {
						if (model[j][i] != 0) {
							temp[tempIdex++] = model[j][i];
						}
					}
					boolean hv = false;
					for (int j = 0; j < X - 1; j++) {
						if (temp[j] == temp[j + 1] && temp[j] != 0) {
							temp[j] = temp[j] * 2;
							temp[j + 1] = 0;
							hv = true;
						}
					}
					goon = hv;
					int is0 = 0;
					for (int j = 0; j < X; j++) {
						model[j][i] = temp[j];
						if (temp[j] == 0)
							is0++;
					}
					if (is0 > 0) {
						xp3[i] = 1;// 可插牌
					}
				}
			}
			// 插牌
			List<Integer> space3 = new ArrayList<Integer>();
			for (int j = 0; j < xp3.length; j++) {
				if (xp3[j] == 1) {
					space3.add(j);
				}
			}
			if (space3.size() == 0) {
				gameover = true;
				System.out.println("game over");
				System.exit(0);
			} else {
				int a = (int) (Math.random() * (space3.size()));
				Integer index = space3.get(a);
				for (int j = 0; j < X; j++) {
					if (model[j][index] == 0) {
						model[j][index] = enumM[(int) (Math.random() * enumM.length)];
						break;
					}
				}
			}
			outPrint();
			break;
		case 97:// A 左
			int[] xp2 = new int[X];
			for (int i = 0; i < X; i++) {
				boolean goon = true;
				while (goon) {
					int[] temp = new int[Y];
					int tempIdex = 0;
					for (int j = 0; j < Y; j++) {
						if (model[i][j] != 0) {
							temp[tempIdex++] = model[i][j];
						}
					}
					boolean hv = false;
					for (int j = 0; j < Y - 1; j++) {
						if (temp[j] == temp[j + 1] && temp[j] != 0) {
							temp[j] = temp[j] * 2;
							temp[j + 1] = 0;
							hv = true;
						}
					}
					goon = hv;
					int is0 = 0;
					for (int j = 0; j < Y; j++) {
						model[i][j] = temp[j];
						if (temp[j] == 0)
							is0++;
					}
					if (is0 > 0) {
						xp2[i] = 1;// 可插牌
					}
				}
			}

			// 插牌
			List<Integer> space2 = new ArrayList<Integer>();
			for (int j = 0; j < xp2.length; j++) {
				if (xp2[j] == 1) {
					space2.add(j);
				}
			}
			if (space2.size() == 0) {
				gameover = true;
				System.out.println("game over");
				System.exit(0);
			} else {
				int a = (int) (Math.random() * (space2.size()));
				Integer index = space2.get(a);
				for (int j = 0; j < Y; j++) {
					if (model[index][j] == 0) {
						model[index][j] = enumM[(int) (Math.random() * enumM.length)];
						break;
					}
				}
			}
			outPrint();
			break;
		default:
			break;
		}
	}


}

 

软件类个人线上比赛手册(C/C++、JAVA 和 Python)

一、赛前准备

1.硬件要求

(1)带摄像头的笔记本电脑或者台式机电脑(不包含苹果电脑)。电脑系统须是

WIN7/8/10 或以上版本。

2)手机和手机支架。手机安装腾讯会议 APP,并配备上网流量卡,保证手机有不低于

5 小时续航时间,提前备好充电设备。

2.软件要求

1)电脑须安装谷歌浏览器或 360 浏览器(考前务必进行浏览器测试)。

2)根据自己报考的比赛科目,安装相应软件环境(请到蓝桥杯大赛官网“学习资料”

菜单下“资料文档”里下载)。

C/C++开发环境:Dev-cpp 5.4.0、C/C++ API 帮助文档

Java 开发环境:JDK 1.8、Eclipse-java-2020-06、API 帮助文档

Python 开发环境:Python 3.8.6、IDLE(Python 自带编辑器)

3)RAR 解压缩软件用于解压试题(5.71 版本以上)。

4)PDF 阅读器用于看题(务必测试是否能打开试题)。

3.网络要求

1)电脑:普通宽带网络即可,建议 10Mbps 以上。

2)手机:单独配备上网 4G/5G 流量卡。(比赛期间手机可连接无线网络。如遇断网

情况,必须在 3 分钟内连接手机的上网流量卡继续比赛并进入腾讯会议)。

说明:如未按要求准备,影响比赛成绩的责任,由选手本人承担。

4.考场环境要求

比赛前 15 分钟,选手将用于云监考的手机放置到侧面对电脑屏幕及自己半身的位置(自

己侧后方约 130 度的位置,如下图),并用手机登录准考证提供的腾讯会议号,以“学校名

称+姓名”命名,打开视频,调整监控画面,将麦克风静音,同时保持听筒有声音,方便在比赛过程中及时接收监考员的提示信息。如因听筒关闭,导致无法接收监考员提示信息,将

会发送红牌警告,影响最终考试成绩,由选手自行承担。比赛全程如遇断网情况,须立即在

3 分钟内连接手机的上网流量卡保持比赛电脑网络在线,同时保持腾讯会议视频实时在线状

态。如腾讯会议因手机没电,网络问题等原因掉线,监考员会在考试系统中发消息提醒重新

登录,请选手在考试过程中及时查看系统消息。腾讯会议掉线次数超过 3 次,或持续掉线时

间一次超过 5 分钟,发送红牌警告,影响最终考试成绩,由选手自行承担。

5.比赛违规行为包含但不限于

(1) 选手携带与比赛内容相关的材料或者存储设备参加比赛。

(2) 比赛期间选手上网查阅资料,登录搜索引擎、BBS 论坛等网站、抄袭或者协助他人

抄袭。

(3) 比赛过程中使用有助于发送或者接收信息功能的电子设备。

(4) 选手由他人冒名代替参加比赛。

(5) 在比赛过程中未经云监考员同意,擅自离开座位。

(6) 比赛过程中选手故意遮挡或者关闭摄像头。

(7) 比赛过程中使用微信、QQ 等即时通讯软件。(8) 比赛过程不服从监考人员安排与要求。

(9) 比赛期间选手关闭考试浏览器。

(10) 监控画面未按照比赛要求设置。

6.比赛注意事项

(1) 比赛当天须在 9 点准时登录比赛系统,不得提前登录

(2) 9 点开考后,30 分钟内未登录比赛系统和腾讯会议的选手视为弃考。

(3) 如选手比赛中遇断网超过十分钟则视为弃考,将由组委会结束其考试。

(4) 如去洗手间须在腾讯会议里用文字向云监考员报备同意,回来后须在腾讯会议

文字告知云监考员。

(5) 比赛过程中选手电脑和腾讯会议都必须全程联网,如果电脑断网需在 3 分钟内恢

复并向监考员报备。腾讯会议掉线次数超过 3 次,或持续掉线时间一次超过 5 分钟,发送红

牌警告,影响最终考试成绩,由选手自行承担。

注:考试期间设置红牌警告制度,确定 3 次违规即取消其比赛资格。

注意提前下载准考证。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>