백준/백준-C++
15953번: 상금 헌터
Beabletoet
2018. 12. 10. 13:42
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 |