比赛 | 20250520模拟测试 | 评测结果 | AWAWAWAWAWAWTTTTTTTT |
---|---|---|---|
题目名称 | 幂次 | 最终得分 | 30 |
用户昵称 | HCl | 运行时间 | 16.052 s |
代码语言 | C++ | 内存使用 | 4.00 MiB |
提交时间 | 2025-05-20 16:03:01 | ||
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,k; map<ll,bool>st; ll cnt; int main(){ freopen("power.in", "r", stdin); freopen("power.out", "w", stdout); cin>>n>>k; if(k==1){ cout<<n; return 0; } for(ll i=2;i<=sqrtl(n);i++){ ll a=i*i,p=2; while(a*i<=n){ a*=i,p++; if(p<k||st[a]) continue; st[a]=1,cnt++; } } cout<<cnt+1; return 0; }