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. [WEB安全]Dirsearch工具命令

    下载项目,并打开 ┌─[root@kali]─[/kali] └──╼ #git clone https://github.com/maurosoria/dirsearch ┌─[root@kali] ...

  2. GO 类型断言

    在Go语言中,我们可以使用type switch语句查询接口变量的真实数据类型,语法如下: switch x.(type) { // cases } x必须是接口类型. 来看一个详细的示例: type ...

  3. html 与 xml 的区别与联系

    [引言] 前一阵子刚刚学习了html(HyperText Markup Language),最近又接触了xml(Extensible Markup Language),它们之间有什么联系和区别呢?现在 ...

  4. nrm切换npm包源

    nrm可以随时切换npm包的源 npm install -g nrm 安装nrm完成 查看nrm源 nrm ls 切换源 npm use npm #也可以切换成其他源 

  5. P5663 加工零件

    P5663 加工零件 题解 暴力搜索 搜索显然会TLE #include<iostream> #include<cstdio> #include<cstdlib> ...

  6. PorterDuffXfermode之PorterDuff.Mode.SRC_OUT

    package com.loaderman.customviewdemo.view; import android.content.Context; import android.graphics.B ...

  7. html js 遮罩层

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. bat 脚本之 使用函数

    bat 脚本之 使用函数 摘自:https://blog.csdn.net/peng_cao/article/details/73999076 2017年06月30日 15:06:37 pengcao ...

  9. Mysql字段修饰符(约束)

    (1).null和not null not null不可以插入null,但可以插入空值. 数值型.字符型.日期型都可以插入null,但只有字符型可以插入空值. 使用方法如下: mysql> cr ...

  10. 基于pythonselect.select模块通信的实例讲解

    基于python select.select模块通信的实例讲解 要理解select.select模块其实主要就是要理解它的参数, 以及其三个返回值. select()方法接收并监控3个通信列表, 第一 ...