题目链接:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1879
题意:G数就是一个数经过平移多次相加所生成的数。
其实就是1,11,111,1111….的倍数
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long n,m,k;
while(~scanf("%lld",&n))
{
k=1;
while(k<n)
{
if(n%k==0)
m=n/k;
k=k*10+1;
}
printf("%lld\n",m);
}
return 0;
}