You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
//这个题目看起来太复杂:https://blog.csdn.net/XieNaoban/article/details/52199420
|
|
|
|
|
unsigned N, A, B, Sp, Sq, ansA, ansB;
|
|
|
|
|
unsigned long long Pofs, K, nowK;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
while (scanf("%u%u%u", &N, &Sp, &Sq) != -1) {
|
|
|
|
|
K = 0xffffffffffffffff;
|
|
|
|
|
for (A = 0; A < 32; ++A)
|
|
|
|
|
for (B = 0; B < 32; ++B) {
|
|
|
|
|
Pofs = (N - 1) * Sp;
|
|
|
|
|
nowK = (Pofs + (Pofs << A) >> B) + Sq;
|
|
|
|
|
if (nowK >= N * Sq && nowK < K) K = nowK, ansA = A, ansB = B;
|
|
|
|
|
}
|
|
|
|
|
printf("%llu %u %u\n", K, ansA, ansB);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|