90分求助,第三点WA了

P1150 Peter 的烟

Score_Elevate @ 2022-09-29 12:48:12

90分求助大佬,第三点WA了,实在不会改

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

求大佬帮改


by Score_Elevate @ 2022-09-29 12:50:38

回复的时候请直接at我,这样我能看见,谢谢


by jnyz2021109122116 @ 2022-10-01 22:38:06

@langziduan 每换取一个烟之后都会多一个烟头,所以l++;


by Score_Elevate @ 2022-10-02 12:30:30

@jnyz2021109122116 好的,谢谢


by Score_Elevate @ 2022-10-03 18:08:41

@jnyz2021109122116 过了,谢谢大佬,此帖结


|