神奇01串

本来想搜索+部分打表 后来想了想还是放弃吧

#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 1000005;
int n, a[N];
int main(){
    scanf("%d", &n);
    if (n == 2){
        puts("Impossible");
        return 0;
    }
    for (int i = 1; i < n; ++i){
        a[(LL)i * i % n] = 1;
    }
    for (int i = 1; i < n; ++i) {
        printf("%d", 1 - a[i]);
    }
}

 

posted @ 2018-08-31 18:07  Trimsteanima  阅读(100)  评论(0编辑  收藏  举报
Live2D