Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7019 | 邓小龙 | 不吉利的数 | C++ | Accepted | 12 MS | 268 KB | 815 | 2025-03-29 16:00:21 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ //遍历给出的区间[m,n]的所有号码 //如果号码不是不吉利数,那么就+1 //如何判断是不是不吉利数:包含4或者62:6097456204 int n,m,cnt=0; bool f;//标记数是否为不吉利数 cin>>n>>m; for(int i=n;i<=m;i++){ int t=i; f=false;//不是不吉利数 while(t){ if(t%10==4 || t%100 == 62){ f=true; break; } t/=10; } if(f==false) cnt++; } cout<<cnt<<endl; return 0; }