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. Tcl模块化

    Proc 过程名 参数列表 过程体 示例代码(斐波那契数列): proc fib {num} { if {$num<=2} {return 1} return [expr [fib [expr ...

  2. javascript创建对象的几种方式?

    javascript创建对象简单的说,无非就是使用内置对象或各种自定义对象,当然还可以用JSON:但写法有很多种,也能混合使用. 1.对象字面量的方式 person={ firstname:" ...

  3. openstack 基镜像展开过程

  4. android: ListView设置emptyView 误区

    使用ListVIew 来设置EmptyView的时候须注意: ListView listview = (ListView) findViewById(R.id.list); View emptyVie ...

  5. APP 抓包-fiddler

    App抓包原理 客户端向服务器发起HTTPS请求 抓包工具拦截客户端的请求,伪装成客户端向服务器进行请求 服务器向客户端(实际上是抓包工具)返回服务器的CA证书 抓包工具拦截服务器的响应,获取服务器证 ...

  6. Linux -- 信号编程

    进程捕捉到信号对其进行处理时,进程正在执行的正常序列就被信号处理程序临时中断,它首先执行该信号处理程序中的指令.如果从信号处理程序返回(例如没有调用exit或longjmp),则继续执行在捕捉到信号时 ...

  7. CentOS7下搭建Ansible自动化运维工具,集中管理服务器

    (1).Ansible具有如下特点: 部署简单,只需在主控端部署Ansible环境,被控端无需做任何操作: 默认使用SSH协议对设备进行管理: 主从集中化管理: 配置简单.功能强大.扩展性强: 支持A ...

  8. 123457---小小数学家--com.twoapp.xiaoxiaoshuxuejia

    小小数学家--com.twoapp.xiaoxiaoshuxuejia

  9. python基础之线程、进程、协程

    线程 线程基础知识 一个应用程序,可以多进程.也可以多线程. 一个python脚本,默认是单进程,单线程的. I/O操作(音频.视频.显卡操作),不占用CPU,所以: 对于I/O密集型操作,不会占用C ...

  10. LeetCode_104. Maximum Depth of Binary Tree

    104. Maximum Depth of Binary Tree Easy Given a binary tree, find its maximum depth. The maximum dept ...