赞
踩
今天现在这里 挖个坑,太忙了,这个专题不一样有时间补完,但我会尽力而为的。记录一下今天的日子:2023/04/21
看看这个坑要什么时候自己才能补完。
题目pdf下载:第十四届蓝桥杯研究生组pdf下载
在此特别感谢博主int 我的文章参考
这道题没啥思路可言,就是简单的对日期进行判断,然后指导一下什么是闰年:
填空题,这是,因此答案是:35813063
package 蓝桥杯专题; public class _2023试题A_特殊日期 { public static void main(String[] args) { int ans = 0; for (int i=2000;i<2000000;i++){ for (int j=1;j<=12;j++){ //对月进行区分 //31天日子 if ( j==1 ||j==3 ||j==5||j==7||j==8 ||j==10 ||j==12 ){ for (int k=1;k<32;k++){ if (i%j==0 && i%k==0){ ans++; } } } //30天日子 else if ( j==4 ||j==6 ||j==9||j==11){ for (int k=1;k<31;k++){ if (i%j==0 && i%k==0){ ans++; } } }else {//即二月 //是闰年 if ((i%4==0&&i%100!=0) || i%400==0 ){ for (int k=1;k<30;k++){ if (i%j==0 && i%k==0){ ans++; } } } //是平年 else{ for (int k=1;k<29;k++){ if (i%j==0 && i%k==0){ ans++; } } } } } } System.out.println(++ans); } }
简单来说,就是限制头上5个数为10101
然后10个选择,每个选择有3中情况,然后其中有多少种结果操作后,结果为1
pow(3,10)=59049,暴力模拟不可取,得动脑了。
填空题,这是,因此答案是:30528
package 蓝桥杯专题; public class _2023试题B_与或异或01 { private static int dp[][] = new int[10][10]; private static int map[][] = new int[10][10]; private static int Status[] = new int[12]; private static int sum = 0; public static void main(String[] args) { dp[0][1] = 1; dp[0][2] = 0; dp[0][3] = 1; dp[0][4] = 0; dp[0][5] = 1; DFS(1); System.out.println(sum); } private static void DFS(int x) { if (x == 11) { for (int i = 1; i <= 4; i++) { map[1][i] = Status[i]; } for (int i = 1; i <= 3; i++) { map[2][i] = Status[i + 4]; } for (int i = 1; i <= 2; i++) { map[3][i] = Status[i + 7]; } for (int i = 1; i <= 1; i++) { map[4][i] = Status[10]; } } for(int i=1;i<=4;i++){ for(int j=1;j<=4-i+1;j++){ if(map[i][j]==0) { dp[i][j]=dp[i-1][j]|dp[i-1][j+1]; } if(map[i][j]==1) { dp[i][j]=dp[i-1][j]^dp[i-1][j+1]; } if(map[i][j]==2) { dp[i][j]=dp[i-1][j]&dp[i-1][j+1]; } } } if(dp[4][1]==1) { sum++; } } }
由于Dotcpp上有对应的题目,以及测试渠道,后面的题目,我就不补充你那个题目详情了,大家可以移步那里观看。
https://www.dotcpp.com/oj/train/1096/
由于这道题,我已经发过一篇文章,因此再这里就不再赘述,大家有需要,可以移步
试题 C: 平均
https://blog.csdn.net/weixin_43554580/article/details/130154949?spm=1001.2014.3001.5502
由于这道题,我已经发过一篇文章,因此再这里就不再赘述,大家有需要,可以移步
试题 D: 棋盘
https://blog.csdn.net/weixin_43554580/article/details/130167554?spm=1001.2014.3001.5502
由于这道题,我已经发过一篇文章,因此再这里就不再赘述,大家有需要,可以移步
试题 E: 互质数的个数
https://blog.csdn.net/weixin_43554580/article/details/130236509?spm=1001.2014.3001.5502
2023/04/22 暂时还没完全解出来,,,,
2023/04/24日,卧槽了!!!写了好多这道题的分析,因为是直接对着原文编辑的,不能暂存,当时卡了一下,我就傻逼,直接刷新了!!!卧槽!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2023/04/29 没能完全通过,具体思路可以参考:
题目 3166: 蓝桥杯2023年第十四届省赛真题-阶乘的和–不能完全通过,最好情况通过67.
https://blog.csdn.net/weixin_43554580/article/details/130438997?spm=1001.2014.3001.5501
2023/04/23 没太搞懂这道题,感觉应该是用优先队列+DFS,从可以全每一次都加满油的情况出发,开始遍历寻找出最优解= =~
2023/04/30日,在此祝大家五一快乐哟!!!
题解已发布,大家可以跳转参考。
https://blog.csdn.net/weixin_43554580/article/details/130451007?spm=1001.2014.3001.5501
package 蓝桥__真题__专题; import java.io.*; import java.util.PriorityQueue; import java.util.Scanner; public class 蓝桥杯2023年第十四届省赛真题__小蓝的旅行计划 { private static int maxn = 200005,n,m,inf = (int)1e9; private static long INF = (long)2e18,ans = 0,mod = (int)1e9+7; private static int rest[] = new int [maxn<<2]; private static int k[] = new int [maxn<<2]; private static int dis[] = new int [maxn]; private static int lim[] = new int [maxn]; private static int cost[] = new int [maxn]; private static int vol = 0; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StreamTokenizer st = new StreamTokenizer(br); static int nextInt() throws Exception {st.nextToken();return (int) st.nval;} static long nextLong() throws Exception {st.nextToken();return (long) st.nval;} static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int T = 1; while (T -- > 0){ //进入开始执行函数体 n = nextInt(); m = nextInt(); vol = m; PriorityQueue<gas> queue = new PriorityQueue<gas>(); for (int i=1;i<=n;i++){ dis[i] = nextInt(); cost[i] = nextInt(); lim[i] = nextInt(); } BuildGas(1,1,n); for (int i=1;i<=n;i++){ vol -=dis[i]; while (vol < 0){ if (queue.isEmpty()){ //如果不能完成 pw.println(-1); return; } gas cur_gas = queue.poll(); int cnt = Math.min(m-query(i,1,n,cur_gas.id_gas,i-1),lim[cur_gas.id_gas]); if (cnt<=0){ continue; } if (cnt <= -vol){ ans+=cur_gas.cost_gas *cnt; vol += cnt; lim[cur_gas.id_gas] = 0; AddGas(1,1,n,cur_gas.id_gas,i-1,cnt); } else { ans += cur_gas.cost_gas * (-vol); lim[cur_gas.id_gas] = cnt+vol; AddGas(1,1,n,cur_gas.id_gas,i-1,-vol); queue.add(new gas((long) cur_gas.id_gas, (int) cur_gas.cost_gas)); vol = 0; } }//while (vol < 0) if (vol>0){ AddGas(1,1,n,i,i,vol); lim[i] = Math.min(lim[i],m-vol); queue.add(new gas(i,cost[i])); } pw.println(ans); }//for (int i=1;i<=n;i++) }//while (T -- > 0){ //进入开始执行函数体 pw.flush(); }//public static void main(String[] args) private static void AddGas(int i, int left, int right, int id_left, int id_right, int volumn) { if (id_left <=1 && right <= id_right){ rest[i]+=volumn; k[i]+=volumn; return; } rotate(i); int mid = left + (right-left)/2; if (mid >= id_left){ AddGas(i<<1,left,mid,id_left,id_right,volumn); //res = Math.max(res,query(i<<1,left,mid,id_left,id_right)); } if (mid < id_right){ AddGas(i<<1|1,mid+1,right,id_left,id_right,volumn); //res = Math.max(res,query(i<<1|1,mid+1,right,id_left,id_right)); } UpGas(i); }//private static void AddGas(int i, int left, int right, int id_left, int id_right, int volumn) private static int query(int i, int left, int right, int id_left, int id_right) { if (id_left <= left && right <= id_right){ //保住了,则直接返回即可。 return rest[i]; } rotate(i); int res = 0; int mid = left + (right-left)/2; if (mid >= id_left){ res = Math.max(res,query(i<<1,left,mid,id_left,id_right)); } if (mid < id_right){ res = Math.max(res,query(i<<1|1,mid+1,right,id_left,id_right)); } UpGas(i); return res; }//private static int query(int i, int left, int right, int id_left, int id_right) { private static void rotate(int i) { if (k[i] != 0){ k[i<<1] += k[i]; k[i<<1 |1] +=k[i]; rest[i<<1] +=k[i]; rest[i<<1|1] +=k[i]; k[i] =0; } }//private static void rotate(int i) private static void BuildGas(int i, int l, int r) { if (l == r){ rest[i] = 0; //到达时油量 return; } int mid = l+(r-l)/2; BuildGas(i<<1,l,mid); BuildGas(i<<1|1,mid+1,r); UpGas(i); }//private static void BuildGas(int i, int l, int r) private static void UpGas(int i) { rest[i] = Math.max(rest[i<<1],rest[i<<1|1] ); }//private static void UpGas(int i) private static class gas implements Comparable<gas>{ //汽油要记录是哪家店加的油,然后加油花费 long cost_gas; int id_gas; public gas(long cost_gas, int id_gas) { this.cost_gas = cost_gas; this.id_gas = id_gas; } @Override public int compareTo(gas o) { return this.cost_gas - o.cost_gas >0 ?1:-1; } }//private static class gas implements Comparable<gas> }//public class 蓝桥杯2023年第十四届省赛真题__小蓝的旅行计划
2023/05/05:
这道题还是不咋会,只能提供一个普通人的会超时的思路,在此就不贴出代码了
因为收效胜微,得分只有23分,且结果有超时,也有错误。:
解题思路:
留个空。先
日期:2023年5月16日
由于这道题,我已经发过一篇文章,因此再这里就不再赘述,大家有需要,可以移步
试题 J: 反异或 01 串
https://blog.csdn.net/weixin_43554580/article/details/130699777?spm=1001.2014.3001.5501
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。