Initiate Luogu
This commit is contained in:
17
Luogu/P1150 Peter 的烟.cpp
Normal file
17
Luogu/P1150 Peter 的烟.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int n,k;
|
||||
cin>>n>>k;
|
||||
int tmp=n;
|
||||
int js=n;
|
||||
while(tmp>k){
|
||||
js+=int(tmp/k);
|
||||
tmp=tmp%k+tmp/k;
|
||||
}
|
||||
cout<<js<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 4%3=1 5%3=2 2+int(5/3)=3 3%3=0
|
||||
6%4=2 2+6/4=3*/
|
Reference in New Issue
Block a user