比赛 ICPC复现(AI数据) 评测结果 AAAAAAAAAA
题目名称 赚的越多,赚的越少 最终得分 100
用户昵称 汐汐很希希 运行时间 0.066 s
代码语言 C++ 内存使用 4.14 MiB
提交时间 2026-05-26 20:13:06
显示代码纯文本
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e9+10;
const int mod=1e4;
ll n,X,K,T,c=0,cnt=0;
map<ll,ll> mp1,mp2;
int main()
{
	
	freopen("zhuan.in","r",stdin);
    freopen("zhuan.out","w",stdout);
	
    cin>>n>>X>>K;
    while(!mp2.count(c)&&cnt<n)
    {
    	mp1[cnt]=c;
    	mp2[c]=cnt;
    	c+=X;
    	c=c-(c/K);
    	cnt++;
    	//cout<<cnt<<' '<<c<<endl;
	}
	if(cnt==n) cout<<c<<endl;
	else{
		T=cnt-mp2[c];
		ll q=cnt-T;
		ll t=n%T+q;
		//cout<<cnt<<' '<<T<<' '<<t<<endl;
		cout<<mp1[t]<<endl;
	}
    return 0;
}