waka @ 2017-07-28 22:54:18
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,num=0,k,a;
cin>>n>>k;
num+=n;
if(k>1)a=n/k;
num+=a;
cout<<num;
return 0;
}
by 次元狮子 @ 2017-07-29 11:17:40
该题数据有点大 试试用long long int
by codesonic @ 2017-08-03 23:35:31
不会大啦。。我int过了
(似乎需要循环、不懂你的思想)
by p9t6g @ 2017-08-14 17:16:14
当最后只剩k-1个烟蒂时,你没办法换(虽然你可以借一只)
by namespace @ 2017-08-16 15:01:59
#include<bits/stdc++.h>
const int maxn=1000+10;
using namespace std;
void read(int &x){
x=0;char c=getchar();
while(c<'0' || c>'9')c=getchar();
while(c>='0' && c<='9'){
x=x*10+c-'0';
c=getchar();
}
}
void write(int x){
if(x==0){putchar(48);return;}
int len=0,dg[20];
while(x>0){dg[++len]=x%10;x/=10;}
for( int i=len;i>=1;i--)putchar(dg[i]+48);
}
int main(){
int i,j,k,m,n,yd,xy;
read(n);
read(k);
do{
yd+=n;
xy+=n;
n=yd/k;
yd-=n*k;
}while(n!=0);
write(xy);
return 0;
}
by c201904 @ 2017-08-18 07:38:49
@c201908 666
by c201904 @ 2017-08-18 07:39:08
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<iomanip>
#include<map>
#include<iostream>
#include<stack>
#include<memory.h>
using namespace std;
int main(){
int n,k,ans=0;
cin>>n>>k;ans=n;
while(n>=k){
ans+=(n/k);
n=n/k+n%k;
}
cout<<ans;
}
by onepunchman @ 2017-09-28 21:14:26
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,n,k,s;
cin>>n>>k;
s=0;
for(i=1;i<=n;i++)
{
s++;
if(s==k&&k!=1)
{
n++;
s=0;
}
}
cout<<n;
return 0;
}