蓝桥杯每日一题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;
}
相关推荐
ychqsq7 小时前
203.诊断
经验分享·职场和发展
ychqsq1 天前
201.春风
经验分享·职场和发展
泡沫_花火1 天前
大模型开发相关岗位面试资料(含算法)
语言模型·自然语言处理·面试·职场和发展
我命由我123452 天前
Photoshop - Photoshop 快速共享作品
学习·ui·职场和发展·求职招聘·职场发展·学习方法·photoshop
我命由我123452 天前
自动化 / 智能装配的对象、内容、层级
运维·学习·职场和发展·自动化·求职招聘·职场发展·学习方法
AI职业加油站2 天前
大模型开发工程师证书怎么考?零基础学习路径与价值拆解
大数据·人工智能·学习·职场和发展·数据分析
blxr_2 天前
力扣hot100爬楼梯https://leetcode.cn/problems/climbing-stairs/
算法·leetcode·职场和发展
我命由我123452 天前
Photoshop - 将Photoshop图像置入其他应用程序
学习·ui·职场和发展·求职招聘·职场发展·学习方法·photoshop
blxr_2 天前
力扣hot100前k个高频元素https://leetcode.cn/problems/top-k-frequent-elements/
算法·leetcode·职场和发展
财情双生教练易和中2 天前
“找矿大会战”产业链,量化统计研究报告
职场和发展·职业发展·创业创新·程序员创富