这样子比较好理解

P1150 Peter 的烟

xawuyulun @ 2023-05-10 21:43:50

#include<iostream>
using namespace std;
int main(){
    int k,n,i=0,d=0;
    cin>>k>>n;
    while(k!=0){
        k--;
        d++;
        i++;
        if(d==n){
            k++;
            d=0;
        }
    }
    cout<<i;
    return 0;
}

by yinhee @ 2023-05-10 22:05:40

谢谢大佬,学会了


by lzyqwq @ 2023-05-10 22:15:58

谢谢大佬,学会了


by Yun_Mengxi @ 2023-05-10 22:22:08

谢谢带佬,学废了


by Jerryfish @ 2023-05-10 22:29:15

谢谢大佬,学会了


|