标签:
1 #include<iostream> 2 using namespace std; 3 int Russia(int m, int n) 4 { 5 int result = 0; 6 while (m != 1) 7 { 8 if (m % 2 != 0) 9 result += n; 10 m = m / 2; 11 n = n * 2; 12 } 13 result += n; 14 return result; 15 } 16 int main() 17 { 18 int m, n; 19 cin >> m >> n; 20 cout << Russia(m, n) << endl; 21 22 }
标签:
原文地址:http://www.cnblogs.com/longzu/p/4400977.html