เพื่อคำนวนค่าใช้จ่ายต่อคน เราจะคำนวนค่าใช้จ่ายทั้งหมด (
เมื่อทราบค่าใช้จ่ายรวมแล้ว ค่าเข้างานน้อยที่สุดที่จะไม่ทำให้ขาดทุนก็คือ
#include <bits/stdc++.h>
using namespace std;
int main () {
int n, m; cin >> n >> m;
int l, k; cin >> l >> k;
int c; cin >> c;
int total_cost = c * l * k;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
int cost; cin >> cost;
total_cost += cost;
}
}
cout << (total_cost + c - 1) / c;
return 0;
}