80救命

P1150 Peter 的烟

EC75 @ 2021-12-15 22:44:22

n,k=map(int,input().split())
print(n+n//k)

Python


by Coros_Trusds @ 2021-12-15 22:51:26

@continue_and_break

n,k=map(int,input().split())
print(n+(n-1)//(k-1))

by EC75 @ 2021-12-16 19:23:27

@Coros_Trusds 谢谢大佬


by hhschhx @ 2022-08-31 17:21:51

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k,c=0,g=0;
    cin>>n>>k;
    while(n>=0){
        g=g+n;
        c=c+n;
        n=c/k;
        c=c%k;
        if(n==0&&c/k<=0){
            cout<<g;
            break;
        }
    }
}
//c++

|