yuanshenqidongQWQ @ 2023-12-08 13:27:02
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,sum=0,cum=0;
cin>>n>>k;
for(int i=1;i<=n;i++){
cum++;
sum=sum+1;
if(sum==k)n++;
}
cout<<cum;
return 0;
}
by _____QWQ_____ @ 2023-12-08 14:35:30
ac代码(其实是改的)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,sum=0,cum=0;
cin>>n>>k;
for(int i=1;i<=n;i++){
cum++;
sum=sum+1;
if(sum==k)
{
n++;
sum=0;
//这里要重置sum
}
}
cout<<cum;
return 0;
}
by _____QWQ_____ @ 2023-12-08 14:36:38
不然的话peter只能交换第一次烟蒂,后面就无法再把烟蒂进行交换
by yuanshenqidongQWQ @ 2023-12-14 12:50:52
@__QAQ__ 谢谢大佬(回复的有点晚)