[noip2014] Solution equation hash+ Qin

Source: Internet
Author: User

Pit = =

Selected several times the prime number, found that this group of reliable

Idea: After each mod to find out all the solution, and then mod again, look at the complexity of almost all the output will not repeat the line

ConstMiArray[1..7] ofInt64= (12537,15437,17647,14677,10003,10009,10007);varN,m,shi,sum,x:int64;        I,j,k,y1:longint; A:Array[-1..102,-1..10000+9] ofInt64; Flag:Array[-1..1000000+9] ofBoolean;        C:char; B:Array[-1..102,1..7] ofInt64; F:Array[-1..100000,1..7] ofBoolean; beginreadln (n,m);                Fillchar (flag,sizeof (flag), true);                Fillchar (F,sizeof (f), true);  fori:=0  toN Do                beginread (c); ifC='-'  Then                        beginj:=0; y1:=-1;End Else beginy1:=1; j:=1; Val (C,a[i,1],K);End; A[i,1]:=a[i,1]*Y1;  while  notEoln Do                        beginInc (J);                        Read (c);                        Val (c,a[i,j],k); A[I,J]:=a[i,j]*Y1; End; A[i,0]:=J;                        READLN; End;  fork:=1  to 7  Do                         fori:=0  toN Do                        beginShi:=1;  forJ:=a[i,0]Downto 1  Do                                beginB[i,k]:= (B[i,k]+a[i,j]*shiMoDMI[K])MoDMi[k]; Shi:=shi*Ten MoDMi[k]; End; End;  fork:=1  to 7  Do                         fori:=1  toMI[K] Do                        beginsum:=0; x:=1;  forj:=0  toN Do                        beginsum:= (Sum+x*b[j,k]MoDMI[K])MoDMi[k]; X:=x*iMoDMi[k]; End; ifSum<>0  Thenf[i,k]:=false; End; Sum:=0;  fori:=1  toM Do                 fork:=1  to 7  Do                if  notF[iMoDMI[K],K] Then beginFlag[i]:=false; BreakEnd;  fori:=1  toM Do ifFlag[i] ThenInc (SUM);                Writeln (sum);  fori:=1  toM Do ifFlag[i] ThenWriteln (i); End.

The students who want to learn this problem must play it by themselves, very important 23333

Like on the collection, Vic private qq:1064864324, add me to discuss issues together, and progress

[noip2014] Solution equation hash+ Qin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.