codeforces@281 B
shui
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=;
int numa[maxn],numb[maxn];
long long suma,sumb;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int etc;
int la=,lb=,last;
suma=;sumb=;
for(int i=;i<n;i++){
scanf("%d",&etc);
if(etc>=)
{
numa[la++]=etc;
suma+=etc;
}
else{
numb[lb++]=-etc;
sumb+=-etc;
}
if(i==n-){
if(etc>=) last=;
else last=;
}
}
int state=-;
for(int i=;state==-&&i<la&&i<lb;i++){
if(numa[i]>numb[i])
state=;
if(numa[i]<numb[i])
state=;
}
if(state==-){
if(la>lb) state=;
if(la<lb) state=;
}
if(suma>sumb) printf("first\n");
else if(suma<sumb) printf("second\n");
else{
if(state==) printf("first\n");
else if(state==) printf("second\n");
else{
if(last==) printf("first\n");
else printf("second\n");
}
}
}
return ;
}
codeforces@281 B的更多相关文章
- codeforces#281 A
脑子有点秀逗 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm ...
- Codeforces Round #281 (Div. 2)
题目链接:http://codeforces.com/contest/493 A. Vasya and Football Vasya has started watching football gam ...
- Codeforces Round #281 (Div. 2) 解题报告
题目地址:http://codeforces.com/contest/493 A题 写完后就交了,然后WA了,又读了一遍题,没找出错误后就开始搞B题了,后来回头重做的时候才发现,球员被红牌罚下场后还可 ...
- Codeforces Round #281 (Div. 2) D(简单博弈)
题目:http://codeforces.com/problemset/problem/493/D 题意:一个n*n的地图,有两个人在比赛,第一个人是白皇后开始在(1,1)位置,第二个人是黑皇后开始在 ...
- Codeforces Round #281 (Div. 2) B. Vasya and Wrestling 水题
B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has becom ...
- Codeforces Round #281 (Div. 2) A. Vasya and Football 模拟
A. Vasya and Football 题目连接: http://codeforces.com/contest/493/problem/A Description Vasya has starte ...
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 水
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分
C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 镜面对称 博弈论
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- java JSON 和 Object 相互转换
1.导入 jackson jar <dependency> <groupId>com.fasterxml.jackson.core</groupId> <ar ...
- java源码之Comparable和Comparator
1,Comparable 简介 Comparable 是排序接口. 若一个类实现了Comparable接口,就意味着“该类支持排序”. 即然实现Comparable接口的类支持排序,假设现在存在“实 ...
- CSVHelper读出乱码 解决方案
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read)) using (StreamRe ...
- javascript try{}catch(e){}
<script language="javascript"> try { throw new Error(10,"asdasdasd") } ca ...
- C++异常注意事项
C++里面catch对于类型转换,限制比参数传递时候要多: 不可以进行标准算术转换和类的自定义转换:在函数参数匹配的过程中,可以进行很多的类型转换.但是在异常匹配的过程中,转换的规则要严厉. 标准算术 ...
- HDU 5228 ZCC loves straight flush( BestCoder Round #41)
题目链接:pid=5228">ZCC loves straight flush pid=5228">题面: pid=5228"> ZCC loves s ...
- Oracle 实现 mysql 更新 update limit
oracle给人的感觉非常落后.使用非常不方便,Toad 这个软件又笨又迟钝.pl/sql更是,90年代的界面风格,速度还卡得要死.并且oracle不支持limit .by default7#zbph ...
- (转)C/C++ 宏详解
众多C++书籍都忠告我们C语言宏是万恶之首,但事情总不如我们想象的那么坏,就如同goto一样.宏有一个很大的作用,就是自动为我们产生代码.如果说模板可以为我们产生各种型别的代码(型别替换),那么宏其实 ...
- bzoj1218: [HNOI2003]激光炸弹(DP二维前缀和)
1218: [HNOI2003]激光炸弹 题目:传送门 题解: 一道经典题目啊... 为了更好的操作...把整个坐标系向右上角移动,从(1,1)开始 那么f[i][j]统计一下以(i,j)作为右上角, ...
- Java多线程编程模式实战指南(三):Two-phase Termination模式--转载
本文由本人首次发布在infoq中文站上:http://www.infoq.com/cn/articles/java-multithreaded-programming-mode-two-phase-t ...