CF2215B.RReeppeettiittiioonn
普及+/提高
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
As a girl born on November 11th (or 11/11), SS loves repetition. For example, her favorite English word is bookkeeper, her favorite letter is W (double-u, double vé, or whatever you call it), her favorite animals are the cat (kitten!) and the rabbit (bunny!), her favorite programming language is C++, her favorite parser is LL(1), her favorite optimization algorithm is branch and bound (BB), her favorite unit is millimeter (mm), her favorite game is LLLL, and her favorite winning hand in Mahjong is Seven Pairs. She plans to release her new songs "Silent-night Satellite" and "Siesta Stella" soon, so she wants to select a "pretty" number to decorate the cover of her new songs.
SS observes this world from a higher perspective, which means she considers an integer concurrently in all standard positional numeral systems, starting from the binary numeral system. SS then calls a positive integer $ n $ $ (b, p) $ -tidy (with $ b,p\ge 2 $ ) if and only if:
- In base- $ b $ representation, $ n $ is represented as $ \overline{d_{k\cdot p-1} d_{k\cdot p-2}\ldots d_1 d_0} $ for some positive integer $ k $ and integers $ 0\le d_i \lt b $ , such that for each $ 0\le i \lt k $ , $ d_{i\cdot p}=d_{i\cdot p+1}=\cdots=d_{(i+1)\cdot p-1} $ .
For example, $ 2233 $ and $ 3355 $ are $ (10,2) $ -tidy, $ 1111 $ is both $ (10,2) $ -tidy and $ (10,4) $ -tidy, and $ 6,737,151=(66\textrm{CCFF})_{16} $ is $ (16,2) $ -tidy. Furthermore, SS defines the tidiness of a positive integer $ n $ as the number of ordered pairs $ (b, p) $ such that $ n $ is $ (b, p) $ -tidy.
SS has given you an integer $ n $ . Your task is to determine the tidiness of $ n $ .
输入格式
Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 1000 $ ). The description of the test cases follows.
The only line of each test case contains a single integer $ n $ ( $ 1\le n\le 10^{12} $ ) — the integer SS has given you.
It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 10^{12} $ .
输出格式
For each test case, output a single integer — the tidiness of $ n $ .
输入输出样例
输入#1
10 1 2 115 1111 2233 3355 191970 6737151 102934760424 618111100000
输出#1
0 0 2 4 5 5 24 9 17 144
说明/提示
In the third test case, $ 115={(55)}{22}={(11)}{114} $ . Therefore, the tidiness of $ 115 $ is $ 2 $ .
In the fourth test case, $ 1111 $ is $ (10, 2) $ -tidy, $ (10, 4) $ -tidy, $ (100, 2) $ -tidy, and $ (1110, 2) $ -tidy.
输入解题思路,AI测评打分。不知道怎么写?