90 #3未过 求改

P1150 Peter 的烟

wenxinran @ 2024-07-25 15:46:21

#include<bits/stdc++.h>
using namespace std;
int n,k,ans,m;
int main(){
    scanf("%d %d",&n,&k);
    ans+=n;
    while(n+m>=k){
        n=(n+m)/k;
        m%=k;   
        ans+=n;
    }
    printf("%d",ans);
    return 0;
}

by Grace34 @ 2024-07-25 16:21:50

@wenxinran

不得不说你真卷

值得学习QAQ


by Grace34 @ 2024-07-25 16:24:17

@ weak_in_code

%%%

大佬 我这种蒟蒻怎敢班门弄斧


by hxy_ @ 2024-07-25 20:02:40

@Grace34 @wenxinran 你俩孤立我 在这聊都不告诉我 没爱了


by Grace34 @ 2024-07-25 21:09:53

@hxy_ 你**又不在线 我咋找你


by Grace34 @ 2024-07-25 21:10:22

@hxy_ 聊啥,不是讨论题目吗


by jebfghbbcdsl @ 2024-07-28 17:46:02

我写的,可以参考一下

#include<cstdio>
int n,k,ans;
int main(){
    scanf("%d%d",&n,&k);
    ans+=n;
    while(n>=k)n=n-k+1,ans++;
    printf("%d",ans);
    return 0;
}

by Grace34 @ 2024-08-02 13:38:19

@jebfghbbcdsl %


by wenxinran @ 2024-08-28 09:48:31

@jebfghbbcdsl 抱歉之前没看到,谢谢哦


上一页 |