这题完全不懂
参考博客: http://blog.youkuaiyun.com/chengouxuan/article/details/6877054
AC 代码
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define LL long long
const int maxn=1000005;
bool flag[maxn];
LL p;
int main()
{
while(scanf("%I64d",&p)&&p!=0){
if(p==2){
printf("Impossible\n");
continue;
}
memset(flag,0,sizeof(flag));
for(LL i=1;i<p;i++) flag[i*i%p]=1;
for(LL i=1;i<p;i++) printf("%d",!flag[i]);
printf("\n");
}
return 0;
}
本文提供了一段用于判断小于给定素数的所有整数中哪些不是该素数平方剩余的C++代码。对于输入的素数p(除了2),程序会生成一个由0和1组成的序列,其中1表示该位置的数不是p的平方剩余。
328

被折叠的 条评论
为什么被折叠?



