Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: chokun
Problemset: Slowly Express
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-13 18:56:47
#include <bits/stdc++.h>
using namespace std;
int main() {
int input_weight;
int current_weight = 0;
while (cin >> input_weight) {
if (input_weight < 0) {
break;
}
current_weight += input_weight;
int trucks_used = 0;
if (current_weight >= 500) {
trucks_used = current_weight / 800;
current_weight = current_weight % 800;
if (current_weight >= 500) {
trucks_used += 1;
current_weight = 0;
}
} else {
trucks_used = 0;
}
cout << trucks_used << endl;
}
}