哇(wa)!玄关

P1150 Peter 的烟

Qhy2023 @ 2024-12-28 09:23:49

怎么错的?

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

本人蒟蒻,勿嘲


by _Xiaoyao_ @ 2024-12-28 09:29:57

@Qhy2023

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

by _Xiaoyao_ @ 2024-12-28 09:30:32

@Qhy2023 ans要加上原来的n根烟


by _Xiaoyao_ @ 2024-12-28 09:32:25

@Qhy2023 求关注,关我大号@Dayao


by zmher @ 2024-12-28 09:37:53

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

by Qhy2023 @ 2024-12-28 09:38:06

@Xiaoyao 测试点信息 3ms/552.00KB WA

1

Wrong Answer.wrong answer On line 1 column 1, read 4, expected 5. 3ms/552.00KB WA

2

Wrong Answer.wrong answer On line 1 column 1, read 4, expected 1. 3ms/556.00KB WA

3

Wrong Answer.wrong answer On line 1 column 1, read 9, expected 1. 3ms/560.00KB WA

4

Wrong Answer.wrong answer On line 1 column 1, read 2, expected 1. 3ms/572.00KB WA

5

Wrong Answer.wrong answer On line 1 column 4, read 0, expected 1. 3ms/552.00KB WA

6

Wrong Answer.wrong answer On line 1 column 1, read 3, expected 1. 3ms/552.00KB WA

7

Wrong Answer.wrong answer On line 1 column 1, read 6, expected 1. 3ms/520.00KB WA

8

Wrong Answer.wrong answer On line 1 column 1, read 8, expected 1. 3ms/596.00KB WA

9

Wrong Answer.wrong answer On line 1 column 1, read 9, expected 1. 4ms/584.00KB WA

10

Wrong Answer.wrong answer On line 1 column 2, read 1, expected 0.


by zmher @ 2024-12-28 09:48:43

求壶关@Qhy2023


by zmher @ 2024-12-28 09:49:56

@Qhy2023

您的@Xiaoyao不会@到他

@Xiaoyao


by Qhy2023 @ 2024-12-28 09:54:45

@zmher@XiaoyaoThank you


by _Xiaoyao_ @ 2024-12-28 11:20:30

@Qhy2023
我可以呀


|