HDOJ 4876 ZCC loves cards
生活随笔
收集整理的這篇文章主要介紹了
HDOJ 4876 ZCC loves cards
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
枚舉組合,在不考慮連續(xù)的情況下推斷能否夠覆蓋L...R,對隨機數(shù)據(jù)是一個非常大的減枝.
通過檢測的暴力計算一遍
ZCC loves cards
Time Limit: 4000/2000 MS (Java/Others)????Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1346????Accepted Submission(s): 335
Problem Description ZCC loves playing cards. He has n magical cards and each has a number on it. He wants to choose k cards and place them around in any order to form a circle. He can choose any several?consecutive?cards the number of which is m(1<=m<=k) to play a magic. The magic is simple that ZCC can get a number x=a1⊕a2...⊕am, which ai means the number on the ith card he chooses. He can play the magic infinite times, but?once he begin to play the magic, he can’t change anything in the card circle including the order.
ZCC has a lucky number L. ZCC want to obtain the number L~R by using one card circle. And if he can get other numbers which aren’t in the range [L,R], it doesn’t matter. Help him to find the maximal R.
Input The input contains several test cases.The first line in each case contains three integers n, k and L(k≤n≤20,1≤k≤6,1≤L≤100). The next line contains n numbers means the numbers on the n cards. The ith number a[i] satisfies 1≤a[i]≤100.
You can assume that all the test case generated randomly.
Output For each test case, output the maximal number R. And if L can’t be obtained, output 0.
Sample Input 4 3 1 2 3 4 5
Sample Output 7 Hint ⊕ means xor
Author 鎮(zhèn)海中學
Source 2014 Multi-University Training Contest 2
Recommend We have carefully selected several similar problems for you:??4881?4880?4879?4878?4877?
Statistic?|?Submit?|?Discuss?|?Note
轉(zhuǎn)載于:https://www.cnblogs.com/bhlsheji/p/5382429.html
總結(jié)
以上是生活随笔為你收集整理的HDOJ 4876 ZCC loves cards的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: hdu1540/poj2892 线段数区
- 下一篇: 搞懂 SynchronizationCo