c++ 90分 题3wa

P1150 Peter 的烟

xingjielong @ 2023-12-24 11:35:47

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

by vzcx_host @ 2023-12-24 11:49:41

虽然 Peter 不会从异次元借烟蒂,但他也不会把很久以前抽过的烟蒂丢掉


by taoyize @ 2024-01-06 09:59:28

第三题的数据为 10 2


by linmoxi @ 2024-01-11 15:16:02

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

|