以上是弱渣的学习过程,及参考的大神博客和知乎,以下是做到的题目
	  G-XORandFavoriteNumber
	  Bobhasafavoritenumberkandaioflengthn.Nowheasksyoutoanswermqueries.Eachqueryisgivenbyapairliandriandasksyoutocountthenumberofpairsofintegersiandj,suchthatl ≤ i ≤ j ≤ randthexorofthenumbersai, ai + 1, …, ajisequaltok.
	  Input
	  Thefirstlineoftheinputcontainsintegersn,mandk(1 ≤ n, m ≤ 100 000,0 ≤ k ≤ 1 000 000)—thelengthofthearray,thenumberofqueriesandBob’sfavoritenumberrespectively.
	  Thesecondlinecontainsnintegersai(0 ≤ ai ≤ 1 000 000)—Bob’sarray.
	  Thenmlinesfollow.Thei-thlinecontainsintegersliandri(1 ≤ li ≤ ri ≤ n)—theparametersofthei-thquery.
	  Output
	  Printmlines,answerthequeriesintheordertheyappearintheinput.
	  Examples
	  Input
	  623
	  121103
	  16
	  35
	  Output
	  7
	  0
	  Input
	  531
	  11111
	  15
	  24
	  13
	  Output
	  9
	  4
	  4
	  Note
	  Inthefirstsamplethesuitablepairsofiandjforthefirstqueryare:(1,2),(1,4),(1,5),(2,3),(3,6),(5,6),(6,6).Notasingleofthesepairsissuitableforthesecondquery.
	  Inthesecondsamplexorequals1forallsubarraysofanoddlength.
	  题目链接:https://vjudge.net/contest/239536#problem/G
	  题解:由于a^a=0;
	  如果a^b=k;则a^k=b;
	  若要a[i]^a[i+1]….^a[j])=k;
	  即(a[1]^a[2]^…a[i])^(a[1]^a[2]^…^a[i-1]^a[i]^a[i+1]….^a[j])。
	  就可以采用前缀和思想。
	  让flag[a[i]^k]表示a[i]^k出现的次数。
                    	
                    	
                    	  
                    	    
                    	    
                    	    
                    	 
    如果您觉得本文的内容对您的学习有所帮助:
     
                    	
                    	   
                    	   关键字:
html