2021第十二届蓝桥杯省赛B组

今日刷题:2021第十二届蓝桥杯省赛B组

目录

Problem A 空间

Problem B 卡片

Problem C 直线

Problem D 货物摆放

Problem E 路径

Problem F 时间显示

其它


Problem A 空间

 思路:

送分题。我们可以把256MB换算成字节=>256*1024*1024*8/32。
答案:67108864
需要注意的是如果编程计算的话,int型结果会是-67,108,864,要把 *8/32变成/4。

//Text

67108864

Problem B 卡片

思路:模拟。

#include<bits/stdc++.h>
using namespace std;
string int_s(int x){
	string s;
	do{
		s+=x%10+'0';
		x/=10;
	}while(x!=0);
	reverse(s.begin(),s.end());
	return s;
} 
int main(){
	
	int a[11];
	for(int i=0;i<10;i++) a[i]=2021;
	for(int i=1;;i++){
		string s=int_s(i);
		//cout<<endl<<i<<endl;
		//for(int j=0;j<=9;j++) cout<<j<<" "<<a[j]<<endl;
		for(int j=0;j<s.size();j++){
		    if(a[s[j]-'0']==0){
		    	cout<<i-1;
		    	return 0;
			}
			a[s[j]-'0']--;	
	    }
	}                                                                                                                                                                                                                         
    return 0;
}
//ACplease!!!


/*  printf("                                                                \n");
	printf("                                                                \n");
	printf("       * * *               * * *             * * *             * * *            \n");
	printf("     *       *           *       *         *      *          *       *         \n");
	printf("    *        *          *         *       *        *        *         *        \n");
	printf("            *           *         *                *                  *      \n");
	printf("           *            *         *               *                  *     \n");
	printf("          *             *         *              *                  *       \n");
	printf("         *              *         *             *                  *            \n");
	printf("        *               *         *           *                  *            \n");
	printf("      *                  *       *          *                  *           \n");
	printf("    * * * * * * *          * * *          * * * * * * *      * * * * * * *                           \n");
*/    

Problem C 直线

略。

Problem D 货物摆放

略。

Problem E 路径

略。

Problem F 时间显示

 样例:

input_case1:
46800999
output_case1:
13:00:00
input_case2:
1618708103123
output_case2:
01:08:23

思路:

由于不需要考虑年月,所以直接求余24*60*60*1000(一天的时间),剩下的就很容易了。

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long ms;
	cin>>ms;
	ms/=1000;
	ms%=(24*60*60);
	int s=ms%60;
	ms/=60;
	int m=ms%60;
	ms/=60;
	int h=ms%60;
    printf("%02d:%02d:%02d",h,m,s);                                                                                                                                                                                                                             
    return 0;
}
//ACplease!!!


/*  printf("                                                                \n");
	printf("                                                                \n");
	printf("       * * *               * * *             * * *             * * *            \n");
	printf("     *       *           *       *         *      *          *       *         \n");
	printf("    *        *          *         *       *        *        *         *        \n");
	printf("            *           *         *                *                  *      \n");
	printf("           *            *         *               *                  *     \n");
	printf("          *             *         *              *                  *       \n");
	printf("         *              *         *             *                  *            \n");
	printf("        *               *         *           *                  *            \n");
	printf("      *                  *       *          *                  *           \n");
	printf("    * * * * * * *          * * *          * * * * * * *      * * * * * * *                           \n");
*/    

其它

Problem G 砝码称重动态规划
Problem H 杨辉三角组合数学问题

Problem I 双向排序

sort骗分≥50%
Problem J 括号序列dp,递归骗分

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值