二次联通门 : LibreOJ #525. 「LibreOJ β Round #4」多项式
官方题解 :
/* LibreOJ #525. 「LibreOJ β Round #4」多项式 由于会有多种解 所以只需要找出一组特殊解即可 */ #include <cstdio> #include <iostream> void read (int &now) { register char c = getchar (); for (now = 0; !isdigit (c); c = getchar ()); for (; isdigit (c); now = now * 10 + c - '0', c = getchar ()); } int Main () { int N; read (N); register int i, j; int L = N; int phi = 1; if (N == 1) return printf ("-1"), 0; for (i = 2; i * i <= L; ++ i) if (L % i == 0) { L /= i, phi *= (i - 1); for (; L % i == 0; L /= i, phi *= i); } if (L != 1) phi *= L - 1; printf ("%d ", L = phi << 1 | 1); ++ phi; for (i = 0; i < phi; ++ i) printf ("0 "); printf ("%d ", N - 1); for (++ i; i < L; ++ i) printf ("0 "); printf ("1"); return 0; } int ZlycerQan = Main (); int main (int argc, char *argv[]) {;}