문제 링크: https://www.acmicpc.net/problem/5940
5940번: Math Practice
One lovely afternoon, Bessie's friend Heidi was helping Bessie review for her upcoming math exam. Heidi presents two integers A (0 <= A <= 45) and B (1 <= B <= 9) to Bessie who must respond with an integer E in the range 1..62. E is the smallest integer in
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int A, B;
cin >> A >> B;
for(int i = A + 1; i <= 62; i++) {
long long n = 1;
int power = i;
while(power--) n *= 2;
while(n > 9) n /= 10;
if(n == B) {
cout << i << '\n';
return 0;
}
}
cout << 0 << '\n';
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
'USACO > Bronze' 카테고리의 다른 글
백준 5948 Bad Random Numbers (USACO December 2010 Bronze 2번) (0) | 2020.04.06 |
---|---|
백준 5947 Book Club (USACO December 2010 Bronze 1번) (0) | 2020.04.06 |
백준 5939 Race Results (USACO November 2010 Bronze 2번) (0) | 2020.03.24 |
백준 5938 Daisy Chains in the Field (USACO November 2010 Bronze 1번) (0) | 2020.03.24 |
백준 18788 Swapity Swap (USACO February 2020 Bronze 3번) (0) | 2020.03.24 |