Submission

Status:

-PP--PP-P--P-P--PP--

Subtask/Task Score:

45/100

Score: 45

User: sakurajima

Problemset: Slowly Express

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-28 13:01:20

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int total_weight = 0;
    int last_weight = 0;

    while (true) {

        int weight;
        cin >> weight;
        if (weight < 0) return 0;

        total_weight = weight + last_weight;

        int amount = 0;
        while (total_weight >= 800) {
            total_weight -= 800;
            amount++;
        }
        if (total_weight >= 500) {
            total_weight -= 500;
            amount++;
        }
        last_weight = total_weight;
        cout << amount << '\n';

    }

}