90332024-02-12 12:30:31akososkaLeggyorsabb pénzkeresés (50)cpp17Wrong answer 2/50155ms4716 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];}
        if(k<m)i=n+1;
        if(j<s && k>=m){s=j;q=i;}
        i++;
    }
    cout<<s;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/03ms1744 KiB
2Wrong answer0/0149ms2768 KiB
3Wrong answer0/23ms2240 KiB
4Wrong answer0/23ms2396 KiB
5Accepted2/23ms2580 KiB
6Wrong answer0/27ms2828 KiB
7Wrong answer0/213ms3044 KiB
8Wrong answer0/217ms3368 KiB
9Wrong answer0/27ms3316 KiB
10Wrong answer0/214ms3284 KiB
11Wrong answer0/230ms4016 KiB
12Wrong answer0/2155ms4168 KiB
13Wrong answer0/2112ms4164 KiB
14Wrong answer0/256ms4272 KiB
15Wrong answer0/2112ms4232 KiB
16Wrong answer0/252ms4356 KiB
17Wrong answer0/250ms4444 KiB
18Wrong answer0/261ms4440 KiB
19Wrong answer0/2135ms4560 KiB
20Wrong answer0/297ms4688 KiB
21Wrong answer0/265ms4568 KiB
22Wrong answer0/283ms4716 KiB
23Wrong answer0/2145ms4524 KiB
24Wrong answer0/282ms4528 KiB
25Wrong answer0/2100ms4528 KiB
26Wrong answer0/267ms4528 KiB
27Wrong answer0/264ms4524 KiB