sixer_120201 @ 2023-10-08 18:29:06
求助只有20分
by wunaidedanjuan @ 2023-10-08 18:30:29
代码呢 ? _ ?
by sixer_120201 @ 2023-10-08 18:39:15
@wunaidedanjuan
# include<iostream>
using namespace std;
int main(){
int n,k,a;
cin>>n>>k;
a = n + n/k;
if (n/k+n-k >= k)
a = a + (n/k+n-k)/k;
cout<<a<<endl;
return 0;
}
by sixer_120201 @ 2023-10-08 18:39:59
@wunaidedanjuan 我是个新手,帮个忙
by wunaidedanjuan @ 2023-10-08 18:40:33
@sixer_120201 。。。。。神奇的格式。。。。 O _ O
by wunaidedanjuan @ 2023-10-08 18:47:17
@sixer_120201 AC微调代码,附注释
#include<iostream>
using namespace std;
int main()
{
int n,k,a;
cin>>n>>k;
a = n;//注意兑换后的烟吸完剩下的烟蒂可能再次凑够 k
while( n/k > 0)//记录现有的烟蒂并判断是否凑够 k
{
a += n/k;
n = n%k + n/k;
}
cout<<a<<endl;
return 0;
}
附本人 AC 代码 O v O
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>
#include<string>
#include<bitset>
#include<cctype>
#include<cstdlib>
#include<functional>
#include<istream>
#include<sstream>
#include<streambuf>
#include<vector>
#define ll long long
using namespace std;
int main()
{
int n,k,ans=0;
scanf("%d%d",&n,&k);
ans=n;
while(n/k>0)
{
ans+=n/k;
n=n%k+n/k;
}
printf("%d",ans);
return 0;
}
by sixer_120201 @ 2023-10-08 18:59:53
@wunaidedanjuan 感谢!!
by LFYdemi @ 2023-10-16 16:12:00
@sixer_120201 哈哈哈哈或或或蚌埠住了这个格式
by sixer_120201 @ 2023-10-16 21:16:24
@LFYdemi
现在搞懂了(笑)
by sixer_120201 @ 2023-10-16 21:17:10
@LFYdemi
你应该发:红红火火恍恍惚惚