234472026-01-23 08:51:12szentedLeggyorsabb pénzkeresés (50)cpp17Wrong answer 0/5029ms912 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    int p;
    int a[100000];
    cin >> n;
    cin >> p;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    int s=0;
    int napok=0;
    int mini_napok=n;
    int j=0;

    for(int i=0; i<n; i++){
        j=i;
        while(s<p && j<n){
            s=s+a[i];
            napok++;
            j++;
        }
        if(napok<mini_napok && j<n && s>=p) mini_napok=napok;
    }
    cout << mini_napok;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/028ms564 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/23ms316 KiB
7Wrong answer0/24ms316 KiB
8Wrong answer0/24ms420 KiB
9Wrong answer0/24ms316 KiB
10Wrong answer0/24ms508 KiB
11Wrong answer0/228ms636 KiB
12Wrong answer0/229ms564 KiB
13Wrong answer0/228ms688 KiB
14Wrong answer0/228ms752 KiB
15Wrong answer0/228ms764 KiB
16Wrong answer0/228ms700 KiB
17Wrong answer0/228ms564 KiB
18Wrong answer0/228ms564 KiB
19Wrong answer0/228ms912 KiB
20Wrong answer0/228ms740 KiB
21Wrong answer0/228ms724 KiB
22Wrong answer0/228ms564 KiB
23Wrong answer0/228ms564 KiB
24Wrong answer0/228ms632 KiB
25Wrong answer0/228ms752 KiB
26Wrong answer0/228ms564 KiB
27Wrong answer0/228ms564 KiB