不90!

P1150 Peter 的烟

Ghy_boy @ 2023-12-09 11:04:06

#include<bits/stdc++.h>
using namespace std;
void mos(int x,int y){
    int peters=x/y,peters2=x%y,s=peters+x;
    if(x==y){
        cout<<x+1;
        return;
    }
    if(x>y){
        if(peters+peters2>=y){s++;}
    }
    cout<<s<<endl;
}
int main()
{
    int a,b;
    cin>>a>>b;
    mos(a,b);
return 0;
}

by qiutong @ 2023-12-09 17:02:19

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

|