蓝桥杯每日一题2023.10.18

题目描述

特别数的和 - 蓝桥云课 (lanqiao.cn)

题目分析

简单枚举每一个可行的数

cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
int flag, ans;
int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++)
	{
		flag = 0;
		int x = i;
		while(x)
		{
			int y = x % 10;
			if(y == 2 || y == 0 || y == 1 || y == 9)flag = 1;
			x /= 10;
		}
		if(flag)ans += i;
	}
	cout << ans;
	return 0;
}
相关推荐
artificiali4 小时前
拼好卷 05
职场和发展
AIsoft_86887 小时前
最好用的会议纪要APP怎么选?功能横评
面试·职场和发展·iphone
aqiu1111117 小时前
【并查集 / 图论】蓝桥云课 - 魔法大陆的城市群(求无向图连通块数量)题解
蓝桥杯·图论
Nil2089 小时前
leetcode 46全排列
算法·leetcode·职场和发展
测试199810 小时前
Jmeter接口自动化生成测试报告html格式详解
自动化测试·python·测试工具·jmeter·职场和发展·测试用例·接口测试
2401_8322981010 小时前
AI重塑职场生态:人机协同开启全新工作范式
职场和发展
火眼金睛炼单词11 小时前
背单词攻略文章
职场和发展
aqiu11111120 小时前
【LeetCode 902】最大为 N 的数字组合 - 详细题解与数位组合思路
数据结构·算法·leetcode·蓝桥杯·数位dp
辰烨chenye1 天前
LeetCode Hot 100 题解 · 子串篇
算法·leetcode·职场和发展