90322024-02-12 12:29:10akososkaLeggyorsabb pénzkeresés (50)cpp17Wrong answer 4/5030ms12904 KiB
#include <iostream>
#include <fstream>

using namespace std;
int n,m;
int main()
{
    cin>>n;
    cin>>m;
    int a[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int k,s=2147483647,q,i=1,j;
    while(i<=n){
        k=0;
        j=0;
        while(k<=m){j++;k=k+a[j];}
        j--;
        if(k>=m)i=n+1;
        if(j<s && k>=m){s=j;q=i;}
        i++;
    }
    cout<<s;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Wrong answer0/03ms1876 KiB
2Wrong answer0/030ms3408 KiB
3Wrong answer0/23ms3164 KiB
4Wrong answer0/23ms2988 KiB
5Wrong answer0/22ms3056 KiB
6Wrong answer0/24ms3048 KiB
7Wrong answer0/24ms3092 KiB
8Wrong answer0/24ms3080 KiB
9Wrong answer0/24ms3136 KiB
10Wrong answer0/24ms3432 KiB
11Accepted2/230ms4688 KiB
12Wrong answer0/230ms5136 KiB
13Wrong answer0/230ms5620 KiB
14Wrong answer0/230ms6352 KiB
15Wrong answer0/230ms7048 KiB
16Wrong answer0/230ms7472 KiB
17Wrong answer0/230ms7968 KiB
18Wrong answer0/230ms8448 KiB
19Wrong answer0/230ms8908 KiB
20Wrong answer0/230ms9412 KiB
21Wrong answer0/230ms10052 KiB
22Wrong answer0/230ms10360 KiB
23Accepted2/230ms10836 KiB
24Wrong answer0/230ms11324 KiB
25Wrong answer0/230ms11796 KiB
26Wrong answer0/230ms12404 KiB
27Wrong answer0/230ms12904 KiB