Skip to content

Add 0037 #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions md/0037.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
เพื่อคำนวนค่าใช้จ่ายต่อคน เราจะคำนวนค่าใช้จ่ายทั้งหมด ($\text{totalCost}$) ก่อน โดยที่ค่าใช้จ่ายทั้งหมดคือประกอบไปด้วย $C L K$ จากลูกค้าทั้งหมด $C$ คน บินคนละ $K$ รอบและใช้เชื้อเพลิงรอบละ $L$ บาท รวมกับค่าประกอบไฟ ซึ่งคือผลบวกของค่าตกแต่งในแต่ละช่องจากทั้งหมด $M \times N$ ช่อง

เมื่อทราบค่าใช้จ่ายรวมแล้ว ค่าเข้างานน้อยที่สุดที่จะไม่ทำให้ขาดทุนก็คือ $\left\lceil \frac{\text{totalCost}}{C} \right\rceil$

```cpp
#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;
}
```