Original title Link: Click here
Idea: Or game theory, you can refer to the previous blog post.
I saw the Nimbo before I understood the previous blog can also use an XOR method to judge the singular situation, because the singular situation is also 0.
so if the current situation is not singular, then I can only make c-a+b. So if when c<a+B, then this can not change, then you can consider a<c+b ....
(An XOR rule is to write a binary code, if the same becomes 0, the difference becomes 1)
Source:
#include <iostream>#include<stdio.h>#include<cstring>using namespacestd;inta[ $];intMain () {intsum; intn,tmp; while(~SCANF ("%d",&N), n) {sum=0; Memset (A,0,sizeof(a)); for(intI=1; i<=n;i++) scanf ("%d",&A[i]); for(intI=1; i<=n;i++) {tmp=0; for(intj=1; j<=n;j++) { if(i==j)Continue; Elsetmp^=A[j]; } if(Tmp<a[i])//How many ways to turn a non-singular situation into a singular situationsum++; } printf ("%d\n", sum); } return 0;}
View Code
HUD 1850 Being A good boy in Spring Festival