Cunning Friends

题目描述

Anthony and his friends Ben and Chris decided to play a game. They have N piles of stones such that the ith-pile contains Ai stones. In one move a player chooses one pile and may take any non-zero number of stones from it. The players take turns. Anthony goes first then Ben and then Chris. If some player cannot make a move (no more stones exist) he loses. Ben colluded with Chris so their goal is to make Anthony lose. But Anthony doesn't want to lose. You have to find out if Anthony can avoid defeat if all players play optimally.

输入

The first line contains one integer N (1≤N≤1e5).
The next line contains N integers Ai (1≤Ai≤1e9).

输出

Print "Lose" if Anthony will lose in this game and "Win" otherwise.

样例输入

3
2 2 1

样例输出

Win

【待补】

放上队友的代码

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+;
ll a[maxn];
int main()
{
int n;
scanf("%d",&n);
ll sum=;
for(int i=;i<=n;i++){scanf("%lld",&a[i]);sum+=a[i];}
sort(a+,a+n+);
if(sum==n)
{
if(n%==) printf("Lose\n");
else printf("Win\n");
}
else if((sum-a[n])==(n-))printf("Win\n");
else if((sum-a[n]-a[n-])==n-)
{
if((n-)% && (a[n-]== || a[n]==))printf("Win\n");
else printf("Lose\n");
}
else printf("Lose\n"); return ;
}

【规律】Cunning Friends的更多相关文章

  1. hdu1452 Happy 2004(规律+因子和+积性函数)

    Happy 2004 题意:s为2004^x的因子和,求s%29.     (题于文末) 知识点: 素因子分解:n = p1 ^ e1 * p2 ^ e2 *..........*pn ^ en 因子 ...

  2. Codeforces Round #384 (Div. 2) B. Chloe and the sequence(规律题)

    传送门 Description Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems ...

  3. ACM/ICPC 之 DP解有规律的最短路问题(POJ3377)

    //POJ3377 //DP解法-解有规律的最短路问题 //Time:1157Ms Memory:12440K #include<iostream> #include<cstring ...

  4. HDU 5795 A Simple Nim 打表求SG函数的规律

    A Simple Nim Problem Description   Two players take turns picking candies from n heaps,the player wh ...

  5. 在sqlserver中做fibonacci(斐波那契)规律运算

    --利用sqlserver来运算斐波那契规律 --利用事物与存储过程 declare @number intdeclare @A intdeclare @B intdeclare @C int set ...

  6. 谈谈黑客攻防技术的成长规律(aullik5)

    黑莓末路 昨晚听FM里谈到了RIM这家公司,有分析师认为它需要很悲催的裁员90%,才能保证活下去.这是一个意料之中,但又有点兔死狐悲的消息.可能在不久的将来,RIM这家公司就会走到尽头,或被收购,或申 ...

  7. Math.abs(~2018),掌握规律即可!

    Math.abs(~2018) 某前端群的入门问题长姿势了,一个简单的入门问题却引发了我的思考,深深的体会到自己在学习前端技术的同时忽略遗忘了一些计算机的基础知识. 对于 JS Math对象没什么可说 ...

  8. COM中需要调用AddRef和Release的10条规律

    COM中需要调用AddRef和Release的10条规律  

  9. hdu 3951 - Coin Game(找规律)

    这道题是有规律的博弈题目,,, 所以我们只需要找出规律来就ok了 牛人用sg函数暴力找规律,菜鸟手工模拟以求规律...[牢骚] if(m>=2) { if(n<=m) {first第一口就 ...

随机推荐

  1. ubuntu dnsmasq

    /var/run/NetworkManager/resolv.conf 而你真实的dns服务器地址,是被这个服务管理维护着的/ local process -> local dnsmasq -& ...

  2. 记录一次腾讯X5内核64位手机初始化失败

    之前一直在使用x5内核,只需要一个jar包和so文件就能让webview实现多余原生webview的水平,在32位的手机上能够正常运行,但是到了64位手机上就报如下错误: E/ERROR:: .... ...

  3. C# 客户端网络请求 对HttpClient的封装

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/a1037949156/article/d ...

  4. (四)OpenCV-Python学习—形态学处理

    通过阈值化分割可以得到二值图,但往往会出现图像中物体形态不完整,变的残缺,可以通过形态学处理,使其变得丰满,或者去除掉多余的像素.常用的形态学处理算法包括:腐蚀,膨胀,开运算,闭运算,形态学梯度,顶帽 ...

  5. Windows10+VMware Workstation Pro+Ubuntu 16.04+Hadoop-2.6.5+IDEA环境搭建(单机&伪分布式&集群)

    (注:下面出现的"czifan"为用户名,需替换成自己的用户名) 本篇博客是在实践该篇博客的过程中的一些补充和修改~ 0 - 安装VMware Workstation Pro 首先 ...

  6. MySQL批量导入Excel数据

    MySQL批量导入Excel数据 1.确定需要导入数据的表名称以及字段,然后在新建的Excel表中,按照表字段正确排序:(注:(Excel文件的名称最好和数据库的名称一致,sheet表的名字最好和表名 ...

  7. ASP生成JSON数据

    原文地址为:ASP生成JSON数据 < %@LANGUAGE = " VBSCRIPT "  CODEPAGE = " 65001 " % >    ...

  8. js 加法

    使用Number()函数可以解决这个问题,如下 var c = Number(a) + Number(b) 这样c得出来的解果是3,

  9. php关于文件上传的两个配置项说明

    ; Maximum allowed size for uploaded files.; http://php.net/upload-max-filesizeupload_max_filesize = ...

  10. 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置

    处理[由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面] 详细错误:HTTP 错误 404.2 - Not Found. 由于 Web 服务器上的“ISAPI 和 ...