Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
153645 陈棋 不吉利的数 C++ Accepted 26 MS 8072 KB 436 2026-05-23 16:34:00

Tests(10/10):


Code:

#include<iostream> using namespace std; const int Max =1000005; int dp[Max]; bool isGood(int x){ while(x>0){ if(x%10==4) return false; if(x%100==62) return false; x/=10; } return true; } int main(){ for(int i=1;i<Max;i++){ dp[i]=isGood(i) ? 1 : 0; } int sum[Max]={0}; for(int i=1;i<Max;i++){ sum[i]=sum[i-1]+dp[i]; } int n,m; while(cin>>n>>m){ cout<<sum[m]-sum[n-1]<<endl; } return 0; }