#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
//前两种情况分类考虑
if(n<=2)
{
printf("-1\n");
return 0;
}
if(n==3)
{
printf("210\n");
return 0;
}
printf("1");
int mod=1,i;
//模拟大数1x10^(n-1)对210取余
for(i=1; i<=n-1; i++)
{
mod*=10;
mod%=210;
if(i<=n-4) printf("0");
}
//此时mod为1x10^(n-1)对210取余的结果,只要在此基础上加上i后取余得0,则i为满足题意的增加值
for(i=1; i<=210; i++)
if((i+mod)%210==0)
{
//若i的位数不足3位,前面补0
printf("%.3d\n",i);
return 0;
}
return 0;
}
Codeforces Round #152 (Div. 2)——B
最新推荐文章于 2022-11-22 15:09:49 发布