W1053「无圆数」
1 Description
派派最近没能抽到喜欢的卡,他变成了一个《原神》黑子。现在他很讨厌看到圆。
尤其是数字里的圆。
通过问题 W1045 - 我超,原,你已经知道数字 0,4,6,8,9 包含圆。
并称呼这个新的计数系统叫做「无圆数」。现在他想将他所能看到的所有数字都变为「无圆数」,即,将所有十进制的正整数向所有「无圆数」进行映射。但是他正忙着玩《崩坏:星穹铁道》,并希望你能慷慨地帮助他解决这个小小的问题。
2 Input
输入仅包含一个正整数 x,表示派派想让你转换的数字。
这里「转换」的意思是,将所有「无圆数」列出后,排序后第 x 个「无圆数」是什么?
2.1 数据范围
(一共 个 )。
3 Output
输出 x 对应的「无圆数」。
4 样例
Sample Input 1
10
Sample Output 1
17
Sample Input 2
100
Sample Output 2
357
Sample Input 3
77777777777777777
Sample Output 3
7777777
5 Hint
前
模拟五进制即可
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int a[] = {1, 2, 3, 5, 7};
int w[50];
int main()
{
ios::sync_with_stdio(0);
ll x;
cin >> x;
int i = 0;
while (x)
{
x--;//卡在这里了(why)
int y = x % 5;
w[++i] = a[y];
x /= 5;
}
for (int j = i; i >= 1; i--)
cout << w[i];
}