80分???求苣荖纠错!!

P1150 Peter 的烟

周_周 @ 2019-05-10 17:00:40

#include<cstdio>
using namespace std;
int main()
{
    long long n,k,num=0,d=0;
    scanf("%lld%lld",&n,&k);
    while(n>0)
    {
        n--;
        num++;
        d++;
        if(d>=k)
        {
            num++;
            d-=k;
        }
    }
    printf("%lld",num);
    return 0;
}

by a135 @ 2019-05-10 17:05:09

#include<bits/stdc++.h>
using namespace std;
int a,b,sum,ans,zz;
int main()
{
    cin>>a>>b;
    while(a!=0)
    {
        a--;

        zz++;
        if(zz==b) 
        {
            zz=0;
            a++;
        }
        sum++;
    }
    cout<<sum;
    return 0;
}

看得懂吗?QAQ


by a135 @ 2019-05-10 17:05:30

我的是100分


by 2018wew @ 2019-05-10 17:53:08

不能用公式吗,6行搞定


by Kevin_Wa @ 2019-05-12 20:22:54

#include<bits/stdc++.h>
using namespace std;
int a,b,sum,ans,zz;
int main()
{
    cin>>a>>b;
    while(a!=0)
    {
        a--;

        zz++;
        if(zz==b) 
        {
            zz=0;
            a++;
        }
        sum++;
    }
    cout<<sum;
    return 0;
}

QAQ


|