社区讨论

TLE求调玄关

B4070[GESP202412 五级] 奇妙数字参与者 1已保存回复 0

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
0 条
当前快照
1 份
快照标识符
@mm7ujh3n
此快照首次捕获于
2026/03/01 22:29
7 天前
此快照最后确认于
2026/03/04 20:10
4 天前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;
long long n,ans,tot,l=1;
int main(){
    scanf("%lld",&n);
    while(n%2==0){
        n/=2;
        tot++;
        if(tot==l){
            tot=0;
            l++;
            ans++;
        }
    }
    for(int i=3;i*i<=n;i+=2){
        tot=0,l=1;
        while(n%i==0){
            n/=i;
            tot++;
            if(tot==l){
                tot=0;
                l++;
                ans++;
            }
        }
    }
    if(n>1) ans++;
    printf("%lld",ans);
	return 0;
} 

回复

0 条回复,欢迎继续交流。

正在加载回复...