Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
68053 Alphys 集合 C++ 编译错误 0 0 MS 0 KB 461 2023-01-23 13:15:39

Tests(0/0):


#include<bits/stdc++.h> using namespace std; long long n,p,k; int main(){ freopen("set.in","r",stdin); freopen("set.out","w",stdout); scanf("%lld%lld%lld", &n, &k, &p); if(n<k){ printf("%lld", n*p); return 0; } ll tot=k,ans=k*p,tmp=k*k; for(int i=1;i<p;i++){ if(tot+tmp-tmp/k<n){ tot+=tmp-tmp/k; ans+=(tmp-tmp/k)*(p-i); } else { ans+=(n-tot)*(p-i); break; } tmp*=k; } printf("%lld", ans); return 0; }


测评信息: