VioletaBabel
15953번: 상금 헌터 본문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<cstdio> int main() { int price1[6] = { 5000000,3000000,2000000,500000,300000,100000 }, t, a, b, res = 0; for (scanf("%d", &t); t--; printf("%d\n", res)) { res = 0; scanf("%d %d", &a, &b); if (a > 0) { for (int i = 0; ++i < 7;) { a -= i; if (a < 1) { res += price1[i - 1]; break; } } } if (b > 0) { int res2 = 5120000; for (int i = 1; i < 32; i *= 2, res2 /= 2) { b -= i; if (b < 1) { res += res2; break; } } } } } | cs |
'백준 > 백준-C++' 카테고리의 다른 글
1350번: 진짜 공간 (0) | 2018.12.31 |
---|---|
1212번: 8진수 2진수 (0) | 2018.12.06 |
1145번: 적어도 대부분의 배수 (0) | 2018.12.06 |
1021번: 회전하는 큐 (0) | 2018.12.04 |
1003번: 피보나치 함수 (0) | 2018.06.26 |