백준 15953번 : 상금 헌터

M1ndCon·2024년 7월 14일
0

Algorithm

목록 보기
26/32


  • Solved.ac 기준 : 브론즈 3
  • 사용언어 C++

문제 해석 및 풀이

  • 두 상금 정보를 가진 배열을 배치하고 해당 정보면 상금을 도출해 합하면 되는 간단한 문제
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

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

    int reward[2][100] = {0,};
    vector<int> firstRank = {0};
    vector<int> secondRank = { 0 };
    int firstReward[6] = { 500,300,200,50,30,10 };
    int secondReward[5];

    for (int i = 1; i <= 6; i++) {
        for (int j = 0; j < i; j++) {
            firstRank.push_back(i);
        }
    }

    for (int i = 1; i <= 5; i++) {
        for (int j = 0; j < pow(2, i-1); j++) {
            secondRank.push_back(i);
        }

        secondReward[i - 1] = pow(2, 10 - i);
    }

    int t;
    cin >> t;

    while (t--) {
        int a, b;
        cin >> a >> b;

        int sumV = 0;

        if (a <= 21) {
            sumV += firstReward[firstRank[a] - 1];
        }

        if (b <= 31) {
            sumV += secondReward[secondRank[b] - 1];
        }

        cout << sumV * 10000 << "\n";
      }

    return 0;
}
profile
게임 개발자 지망생

0개의 댓글