※ 글쓴이는 취미로 코딩을 익혀보는 사람이라 정확하지 않은 내용을 담고 있을 수 있다 ※

 

이번에 볼 문제는 백준 26532번 문제인 Acres이다.
문제는 아래 링크를 확인하자.

https://www.acmicpc.net/problem/26532 

 

26532번: Acres

You have a rectangular field you want to plant with corn. You know the dimensions of the field in yards, and you know that one bag of corn seed will cover 5 acres. Having passed all your elementary math courses you also know that 4840 square yards is equal

www.acmicpc.net

본문에서 4840 square yard가 1 acre과 같다는 점을 주었으므로, 각 bag of corn seed로 덮을 수 있는 면적은 5 * 4840 = 24200 square yard가 된다.

 

주어진 직사각형 모양의 field의 가로와 세로를 이용해 field의 면적을 구하고, 위에서 계산한 값을 이용해 이 field를 덮기 위해 필요한 최소 bag의 개수를 계산해 문제를 해결하자.

 

아래는 제출한 소스코드이다.

#include <iostream>
using namespace std;
typedef long long ll;

ll r, c;
ll A;

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

	cin >> r >> c;
	A = r * c;

	cout << (A - 1) / 24200 + 1;
}
728x90

'BOJ' 카테고리의 다른 글

[BOJ 14337 // Visual Basic] Helicopter  (0) 2022.12.19
[BOJ 2393 // Cobol] Rook  (0) 2022.12.19
[BOJ 2387 // Algol 68] Howl  (0) 2022.12.19
[BOJ 26574 // C++] Copier  (0) 2022.12.19
[BOJ 5300 // C++] Fill the Rowboats!  (0) 2022.12.19

+ Recent posts