[UVa #10300] Ecological Premium

tolelom·2022년 7월 6일
0

UVa

목록 보기
19/20

문제 설명

문제 링크
주어진 방법에 따라 농부가 받을 지원금을 계산하시오

알고리즘

((땅 크기 / 동물 수) * 환경 친화도) * 동물 수 = 땅 크기 * 환경 친화도
로 쉽게 계산 가능하다

코드

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 1000000000

int t;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> t;

    for (int tc = 1; tc <= t; tc++){
        int n; cin >> n;

        int ans = 0;
        for (int i = 1; i <= n; ++i) {
            int a, b, c;
            cin >> a >> b >> c;
            ans += a * c;
        }
        cout << ans << '\n';
    }
}
profile
이것 저것 작성하는 기술 블로그

0개의 댓글