POJ1613 147/思维题

时间:2023-03-09 15:36:40
POJ1613 147/思维题

题目链接[https://www.oj.swust.edu.cn/problem/show/1613]

题意:输出第K小的由1、4、7数字组成的数字。

解题过程:1、4、7、11、14、17、41、44、47。。。。。。。找规律。

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = ;
const int mod = 1e9+;
int a[]={,,,};
int ans[maxn];
int k;
int main ()
{
while(~scanf("%d",&k))
{
int len=;
while(k)
{
int t=k%;
if(t==) t=;
ans[++len]=a[t];
k=(k-t)/;
}
for(int i=len;i>=;i--)
printf("%d",ans[i]);
printf("\n");
}
return ;
}