"POJ" "2960" S-nim

Source: Internet
Author: User

Game theory

That's like Bzoj 1874 for a pebble game.

First burst of the SG function within 10000 (using the definition to find out)

Then each query directly to the SG value can be different or up ...

1 Source Code2Problem:2960user:sdfzyhy3 memory:444k time:313ms4language:g++result:accepted5 6 Source Code7 8     //POJ 29609#include <cstdio>Ten#include <cstring> One     #defineF (i,j,n) for (int i=j;i<=n;++i) A     intGetint () { -         intv=0, sign=1;CharCh=GetChar (); -          while(ch<'0'|| Ch>'9'){if(ch=='-') sign=-1; Ch=GetChar ();} the          while(ch>='0'&&ch<='9') {v=v*Ten+ch-'0'; Ch=GetChar ();} -         returnv*=Sign ; -     } -     Const intn=10010; +     /******************tamplate*********************/ -     intf[n],s[101]; +     BOOLMark[n]; A     voidCALSG (intN) { atf[0]=0; -F (I,1,10000){ -memset (Mark,0,sizeofmark); -F (J,1, N)if(i-s[j]>=0) -mark[f[i-s[j]]]=1; -F (J,0Iif(!mark[j]) {f[i]=j; Break;} in         } -     } to     intMain () { +         intn,m,k; -          while(SCANF ("%d", &n)!=eof &&N) { theF (I,1, N) s[i]=getint (); *m=getint (); $ CALSG (n);Panax NotoginsengF (I,1, M) { -k=getint (); the                 intans=0; +F (J,1, k) ans^=F[getint ()]; Aprintf (ans?)"W":"L"); the             } +printf"\ n"); -         } $         return 0; $}
View Code

"POJ" "2960" S-nim

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.