90342024-02-12 12:31:32akososkaLeggyorsabb pénzkeresés (50)cpp17Wrong answer 4/50155ms4852 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/0149ms2892 KiB
3Wrong answer0/23ms2280 KiB
4Wrong answer0/23ms2528 KiB
5Wrong answer0/23ms2736 KiB
6Wrong answer0/27ms3120 KiB
7Wrong answer0/213ms3200 KiB
8Wrong answer0/217ms3372 KiB
9Wrong answer0/27ms3460 KiB
10Wrong answer0/214ms3456 KiB
11Accepted2/230ms4320 KiB
12Wrong answer0/2155ms4568 KiB
13Wrong answer0/2112ms4620 KiB
14Wrong answer0/254ms4728 KiB
15Wrong answer0/2112ms4620 KiB
16Wrong answer0/252ms4624 KiB
17Wrong answer0/250ms4620 KiB
18Wrong answer0/261ms4724 KiB
19Wrong answer0/2136ms4616 KiB
20Wrong answer0/297ms4732 KiB
21Wrong answer0/265ms4852 KiB
22Wrong answer0/283ms4836 KiB
23Accepted2/2144ms4720 KiB
24Wrong answer0/282ms4720 KiB
25Wrong answer0/298ms4740 KiB
26Wrong answer0/267ms4716 KiB
27Wrong answer0/264ms4716 KiB