40分求助,样例能过

P1150 Peter 的烟

yyz0526 @ 2024-02-24 10:40:43

#include <stdio.h>
using namespace std;
int main(){
    int n,k,x;
    scanf("%d%d",&n,&k);
    x=n/k;
    if(x+n%x*k>=k){
        x++;
    }
    printf("%d",x+n);
    return 0;
}

3 #6 #7 #8 #9 #10错


by 2023hkm @ 2024-02-24 11:13:54

AC代码

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    cout<<n+(n-1)/(k-1);
    return 0;
} 

求关


by yyz0526 @ 2024-02-25 13:17:50

@2023hkm yiihuiguan已回关~


|