Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
67796 wssdr 集合 C++ 通过 100 0 MS 248 KB 329 2023-01-19 12:25:42

Tests(10/10):


#include<bits/stdc++.h> #define LL long long using namespace std; LL n,k,p,res,ans,cnt; int main(){ // freopen("set.in","r",stdin); // freopen("set.out","w",stdout); scanf("%lld%lld%lld",&n,&k,&p);res=k; while(cnt<p&&res<n){ ans+=res; res*=k; ++cnt; } ans+=n*(p-cnt); printf("%lld\n",ans); return 0; }


测评信息: