跳到正文

题解

P15798 题解

zhouchenyou_0709约 1 分钟
原文
文章信息与版本

文章信息

发布
2026年3月18日
收录
2026年4月2日
更新
2026年11月13日
篇幅
约 1 分钟
题目
P15798

版本

  1. v1当前

思路

其实只要判断aia_i是否只能被22或55整除就行了。

AC代码

C++
#include<bits/stdc++.h>
#define AC return 0;
#define int long long //不开long long见祖宗
using namespace std;
bool check(int n){
	while(n % 2 == 0){
		n /= 2;
	}
	while(n % 5 == 0){
		n /= 5;
	}
	if(n == 1){
		return true;
	}
	return false;
}
signed main(){
	int n, m, cnt = 0;
	cin >> n >> m;
	for(int i = n;i <= m;i++){
		if(check(i)){
			cnt++;
		}
	}
	cout << cnt;
	AC //AC
}

管理员求过!!!

原文