Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
67795 wssdr 集合 C++ 运行出错 0 0 MS 240 KB 325 2023-01-19 12:25:28

Tests(0/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; }


测评信息: