蓝桥杯每日一题2023.9.24

九进制转十进制 - 蓝桥云课 (lanqiao.cn)

题目描述

分析

cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
	cout << 2 * 9 * 9 * 9 + 0 * 9 * 9 + 2 * 9 + 2;
	return 0;
}

顺子日期 - 蓝桥云课 (lanqiao.cn)

题目描述

分析

全部枚举

cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
int ans = 0;
int m[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool is_ren(int x)
{
	if((x % 4 == 0 && x % 100 != 0) || x % 400 == 0)return true;
	return false;
}
int main()
{
	if(is_ren(2022))m[2] = 29;
	for(int i = 1; i <= 12; i ++)
	{
		for(int j = 1; j <= m[i]; j ++)
		{
			int cnt = 0;
			string s = "2022";
			if(i < 10)s += "0";
			string k = to_string(i);
			//cout << k << "KKK" << '\n';
			s += k;
			if(j < 10)s += "0";
			string q = to_string(j);
			s += q;
			//cout << s << '\n';
			for(int p = 0; p < s.size() - 1; p ++)
			{
				if(s[p] - '0' + 1 == s[p + 1] - '0' && s[p + 1] - '0' + 1 == s[p + 2] - '0')cnt ++;
			}
			if(cnt)ans ++;
		}
	}
	cout << ans;
	return 0;
}
相关推荐
qq_459234425 天前
【题库】| 商用密码应用安全性评估从业人员考核题库(四十)
职场和发展·密码学·学习方法·考核·商用密码·商用密码应用安全性评估·密评
敲敲了个代码5 天前
[特殊字符] 空数组的迷惑行为:为什么 every 为真,some 为假?
前端·javascript·react.js·面试·职场和发展
诚思报告YH5 天前
视频面试软件市场洞察:2026 - 2032年复合年均增长率(CAGR)为10.3%
面试·职场和发展
重生之后端学习5 天前
74. 搜索二维矩阵
开发语言·数据结构·算法·职场和发展·深度优先
tyb3333335 天前
leetcode:吃苹果和队列
算法·leetcode·职场和发展
Pitiless-invader5 天前
MySQL 相关知识及面试问题汇总
面试·职场和发展
重生之后端学习6 天前
35. 搜索插入位置
java·数据结构·算法·leetcode·职场和发展·深度优先
逆境不可逃6 天前
【从零入门23种设计模式08】结构型之组合模式(含电商业务场景)
线性代数·算法·设计模式·职场和发展·矩阵·组合模式
筱昕~呀6 天前
冲刺蓝桥杯-DFS板块(第二天)
算法·蓝桥杯·深度优先
zheshiyangyang6 天前
前端面试基础知识整理【Day-10】
前端·面试·职场和发展