嘿嘿嘿,还是不怎么会做,太tmd神奇了
1 #include2 #define inf 0x7fffffff 3 #define LL long long 4 #define N 100005 5 using namespace std; 6 inline int ra() 7 { 8 int x=0,f=1; char ch=getchar(); 9 while (ch<'0' || ch>'9') { if (ch=='-') f=-1; ch=getchar();}10 while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}11 return x*f;12 }13 int mod[5]={ 11261,19997,22877,21893,14843};14 int n,m;int ans[1000005];15 int a[5][105],pre[5][105],res[5][30005];16 char ch[10005];17 int cal(int t, int x)18 {19 int sum=0;20 for (int i=0; i<=n; i++)21 sum=(sum+a[t][i]*pre[t][i])%mod[t];22 if (sum<0) sum+=mod[t];23 return sum;24 }25 bool judge(int x)26 {27 for (int t=0; t<5; t++)28 if (res[t][x%mod[t]]!=0) return 0;29 return 1;30 }31 int main()32 {33 n=ra(); m=ra();34 for (int i=0; i<=n; i++)35 {36 scanf("%s",ch+1);37 int l=strlen(ch+1);38 bool flag=0;39 for (int t=0; t<5; t++)40 if (ch[1]!='-') a[t][i]=ch[1]-'0';41 else a[t][i]=0,flag=1;42 for (int t=0; t<5; t++)43 {44 for (int k=2; k<=l; k++)45 a[t][i]=(a[t][i]*10+ch[k]-'0')%mod[t];46 if (flag) a[t][i]=-a[t][i];47 }48 }49 for (int t=0; t<5; t++)50 for (int x=1; x