AC了两个点,求救

P1150 Peter 的烟

KOGU @ 2023-11-07 12:49:47

#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,s,d=0;
    cin>>a>>s;
    while(a<=s){
        a++;
    }
    a++;
    cout<<a;
    return 0;
}

by zrl123456 @ 2023-11-10 20:50:12

题意理解错了


by zrl123456 @ 2023-11-10 20:50:51

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

by lzy_Dennis @ 2023-12-05 21:49:14

小学解法自己研究

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

|