おさげ / paizaOnlineHackathon8

paiza.jp

#include <iostream>
using namespace std;

void Solve(int n)   {
    int m, t, time = 60*n, count = 0;

    cin >> m;
    for (count=0; count<m; ++count) {
        cin >> t;
        time -= t;
        if (time <= 0)  break;
    }
    if (m == count) cout << "OK" << endl;
    else    cout << count << endl;
}

int main(void)  {
    int n;

    cin >> n;
    Solve(n);
    return 0;
}

nを秒に直しmで引いていき0未満になった場合、その段階までの回数を出力。
収まった場合はOKを出力。
〜了〜