80pts求助
查看原帖
80pts求助
335094
Lucifero楼主2020/12/27 22:57
#include <bits/stdc++.h>
using namespace std;
__int128_t ans;
long long n;
void output(__int128_t x)
{
	if (x>=10) output(x/10);
	putchar(x%10+'0');
}
void dfs(__int128_t x,int cnt)
{
	if (cnt==24) return;
	if (x%n==0 && (ans==0 || ans>x)) ans=x;
	dfs(x*10,cnt+1);
	dfs(x*10+1,cnt+1);
}
int main()
{
	//A*B Problem
	scanf("%lld",&n);
	dfs(1,1);
	if (ans!=0)
	{
		ans/=n;
		printf("%lld ",(long long)ans);
		ans*=n;
		output(ans);
	}
}
2020/12/27 22:57
加载中...