首页 > 其他分享 >1245. 特别数的和

1245. 特别数的和

时间:2022-10-05 11:00:18浏览次数:73  
标签:10 特别 return temp int num 1245 include

https://www.acwing.com/problem/content/1247/

简单模拟水题一道

#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstdio>
using namespace std;
int n,sum;
int cal(int m)
{
	int num=m;
	while(num>0)
	{
		int temp=num%10;
		if(temp == 2 || temp==0 || temp==1 || temp==9)return m;
		num/=10;
	}
	return 0;
}

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		sum+=cal(i);
	}
	cout << sum << endl;
	return 0;
}

 

标签:10,特别,return,temp,int,num,1245,include
From: https://www.cnblogs.com/lxl-233/p/16755222.html

相关文章