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

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

S-Nim

系統(tǒng) 2453 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元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

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

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 桃江县| 应用必备| 南漳县| 贡嘎县| 沙洋县| 富平县| 阳曲县| 托里县| 东城区| 内江市| 南岸区| 雷波县| 昌乐县| 乡宁县| 武宣县| 台州市| 天津市| 古丈县| 如皋市| 忻州市| 浦江县| 彰化市| 铜梁县| 读书| 汝阳县| 中卫市| 南皮县| 安化县| 京山县| 永安市| 雷州市| 开江县| 金堂县| 庆云县| 曲阜市| 济阳县| 阜阳市| 巴林左旗| 东城区| 湖北省| 东阳市|