2020年信息学奥赛csp-j阅读程序题:
#include <iostream> using namespace std; long long n, ans; int k, len; long long d[1000000]; int main() { cin >> n >> k; d[0] = 0; len= 1; ans = 0; for (long long i = 0; i <n; ++i) { ++d[0]; for (int j = 0; j + 1<len; ++j) { if (d[j] == k) { d[j] = 0; d[j + 1] += 1; ++ans; } } if (d[len- 1] == k) { d[len - 1] = 0; d[len] =1; ++len; ++ans; } } cout << ans << endl; return 0; }
假设输入的n是不超过2^62的正整数,k都是不超过10000的正整数,完成下面的判断题和单选题:
若k>1,则输出ans时,k^len—定大于n。()
(1030-1015)/2
(1030+1015)/2
1
1015
(330-1)/2
330
330-1
(330+1)/2
11,112,222,444,543
11,122,222,444,453
11,122,222,444,543
11,112,222,444,453