#include#include#include#include#include#include

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

S-Nim

系統(tǒng) 2465 0

http://acm.hdu.edu.cn/showproblem.php?pid=1536

SG經(jīng)典題,不多說

?

    // File Name: hdu1536.cpp

// Author: bo_jwolf

// Created Time: 2013年09月30日 星期一 18:23:53



#include<vector>

#include<list>

#include<map>

#include<set>

#include<deque>

#include<stack>

#include<bitset>

#include<algorithm>

#include<functional>

#include<numeric>

#include<utility>

#include<sstream>

#include<iostream>

#include<iomanip>

#include<cstdio>

#include<cmath>

#include<cstdlib>

#include<cstring>

#include<ctime>



using namespace std;



const int N = 105 ;

const int MAXN = 10100;

bool vis[MAXN];

int sg[MAXN];

int si[ MAXN ] , n ;

int Getsg( int N )

{//printf( " n = %dn",n );

    int hash[105] = {0};

    for( int i = 0; i < n && si[i] <= N; ++i )

    {

         if( sg[N-si[i]] == -1 )

             sg[N-si[i]] = Getsg( N - si[i] );

         hash[sg[N-si[i]]] = 1;

     }

     for( int i = 0; ; i++ )

          if( !hash[i] )

              return i;

}



int main(){

    int temp , ans , m  ; 

    while( scanf( "%d" , &n ) != EOF && n ){

        for( int i = 0 ; i < n ; ++i ){

            scanf( "%d" , &si[ i ] ) ;

        }

        memset( sg , -1 , sizeof( sg ) ) ;

        sort( si , si + n ) ;

        int Case ;

        scanf( "%d" , &Case ) ;

        while( Case-- ){

            scanf( "%d" , &m ) ;

            ans = 0;

            for( int i = 0 ; i < m ; ++i ){

                scanf( "%d" , &temp ) ;

                ans ^= Getsg( temp ) ;

            }

            if( ans ==  0 ) cout << "L"  ;

            else cout << "W"  ;

        }

        cout << endl ;

    }

return 0;

}
  


?

?

S-Nim


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 山东| 隆回县| 耒阳市| 曲麻莱县| 麦盖提县| 永丰县| 琼海市| 大关县| 沅陵县| 濉溪县| 岗巴县| 团风县| 句容市| 万盛区| 京山县| 游戏| 丽水市| 理塘县| 容城县| 庆云县| 历史| 恭城| 侯马市| 黎城县| 尤溪县| 吉水县| 遂川县| 扶余县| 梁山县| 含山县| 共和县| 梅河口市| 仪征市| 闻喜县| 吉林市| 毕节市| 宁都县| 楚雄市| 灵川县| 青阳县| 三穗县|