218492026-01-14 09:16:32BravoLeggyorsabb pénzkeresés (50)cpp17Wrong answer 2/50164ms1136 KiB
#include <iostream>
#include <fstream>
#include <climits>
using namespace std;

int main()
{
   // ifstream f("sor.txt");
    int n,k;
    cin >> n >> k;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    int penz[n];
    for(int i=0;i<n;i++){
        int c=0,z=0;
        int o=i;
        while(c<k){
            c+=a[o];
            o++;
            z++;
        }
        penz[i]=z;
    }
    int c=INT_MAX;
    for(int i=0;i<n;i++){
        if(penz[i]<c){
            c=penz[i];
        }
    }
    cout << c;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/0158ms1136 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/26ms316 KiB
7Wrong answer0/212ms316 KiB
8Wrong answer0/214ms508 KiB
9Wrong answer0/24ms316 KiB
10Wrong answer0/214ms316 KiB
11Accepted2/230ms1088 KiB
12Wrong answer0/2164ms1076 KiB
13Wrong answer0/2119ms1044 KiB
14Wrong answer0/254ms1076 KiB
15Wrong answer0/2118ms1076 KiB
16Wrong answer0/252ms1072 KiB
17Wrong answer0/250ms1076 KiB
18Wrong answer0/265ms1036 KiB
19Wrong answer0/2142ms1072 KiB
20Wrong answer0/2101ms992 KiB
21Wrong answer0/270ms1076 KiB
22Wrong answer0/289ms1076 KiB
23Wrong answer0/2158ms1088 KiB
24Wrong answer0/286ms1076 KiB
25Wrong answer0/2105ms948 KiB
26Wrong answer0/268ms968 KiB
27Wrong answer0/267ms1076 KiB