题解 1625: 蓝桥杯算法训练VIP-寂寞的数

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

set容器解法

```cpp#include#include#includeusingnamespacestd;intd(intn){inttend=n;while(n){tend=tend+n%10;n=n/10;}returntend;}//定义一个函数计算d(i)intmain(){intnum;cin>>nu

暴力寂寞的数

摘要:解题思路:想太多思维容易一坨,还是暴力吧。。注意事项:参考代码:def d(num):     temp = [int(i) for i in str(num)]     return num +……

筛选法做题

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int s[10000+1]; //值为1表示下标为 非寂寞数。值为0则表示下标为寂……

Python时间超限解决方法

摘要:解题思路:如果给出的n非常大,需要循环的次数非常多,导致时间超限。不妨恰定一个范围,使循环次数大大减少。注意事项:参考代码:def b(n):    s = 0    for i in range(l……