133 条题解
-
3
吴哥——传奇 LV 8 @ 2017-09-14 23:38:54
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; //先取的人可以比较所有奇数位置数之和与所有偶数位置之和,哪个大就一直取相应的位置上的数....注意N为整数 // //比如,6 1000 564 48 400 2 // //奇数位置和为6+564+400=970 偶数位置和为1000+48+2=1050>970 // //故先去的人可以先取2 后取的必定在奇数位置上取数(他只能取奇数位置的了) // //PS:先取的不一定是当前最优....... int main() { int k,q; scanf("%d",&k); for(q=1;q<=k;q++) { int n,who; int a; scanf("%d\n%d\n",&n,&who); for(int i=1;i<=n;i++) { scanf("%d",&a); } if(who==0) printf("wind\n"); else printf("lolanv\n"); } return 0; }
-
12018-03-11 08:48:00@
搞不明白为什么java总是超时,即使用nextLine(),整个代码的时间才O(k),但是过不了,而用c的话要两层嵌套,却能过。难道是底层的机制问题?不知道有没有人能够讲解!!!!
#include <stdio.h> int main(int argc, char const *argv[]) { int k,q; scanf("%d",&k); while(k != 0) { int n,who; int a; scanf("%d\n%d\n",&n,&who); for(int i=1;i<=n;i++) { scanf("%d",&a); } if(who==0) printf("wind\n"); else printf("lolanv\n"); k--; } return 0; }
-
02017-09-17 18:41:52@
//注意不要超时就好 #include<cstdio> using namespace std; int ans[11]; int main() { int i,n,k,j,a; scanf("%d",&k); for(j=1;j<=k;j++) { scanf("%d",&n); scanf("%d",&ans[j]); for(i=1;i<=n;i++) scanf("%d",&a); } for(i=1;i<=k;i++) if(!ans[i]) printf("wind\n"); else printf("lolanv\n"); return 0; }
-
02016-07-15 19:24:15@
多余的废物不用输入!
-
02016-02-26 22:10:30@
var i,m,k:longint;
begin
readln(k);
for i:=1 to k do
begin
readln;
readln(m);
readln;
if m=1 then writeln('lolanv') else writeln('wind');
end;
end. -
02015-07-31 16:00:20@
测试数据 #0: Accepted, time = 3 ms, mem = 500 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 504 KiB, score = 10
测试数据 #2: Accepted, time = 1 ms, mem = 496 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 504 KiB, score = 10
测试数据 #4: Accepted, time = 1 ms, mem = 500 KiB, score = 10
测试数据 #5: Accepted, time = 15 ms, mem = 496 KiB, score = 10
测试数据 #6: Accepted, time = 50 ms, mem = 500 KiB, score = 10
测试数据 #7: Accepted, time = 31 ms, mem = 500 KiB, score = 10
测试数据 #8: Accepted, time = 312 ms, mem = 500 KiB, score = 10
测试数据 #9: Accepted, time = 328 ms, mem = 500 KiB, score = 10
Accepted, time = 741 ms, mem = 504 KiB, score = 100
代码
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int k,n,m,i,s=0,ans=0,a;
scanf("%d",&k);
while(k--)
{
scanf("%d",&n);
scanf("%d",&m);
for(i=1;i<=n;i++)scanf("%d",&a);
if(m==1)printf("lolanv\n");
else printf("wind\n");
}
return 0;
}谁先取,谁就赢。
-
02015-03-30 22:21:25@
好阴险的题。。果断dp超时
-
02015-02-02 14:16:31@
1.必须用scanf才能过。
2.让后手取奇数还是偶数的权力掌握在先手的手中。
3.这道题说明我缺乏一种整体思考的观念。只善于微观分析、不善于整体把握。
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
char name[][10] = { "wind", "lolanv" };
int t;
cin >> t;
int size, who;
while (t-- > 0){
cin >> size >> who;
int i,j;
for (i = 0; i < size; i++)
scanf("%d", &j);
cout << name[who] << endl;
}
return 0;
} -
02014-01-23 01:39:39@
刚看完论文,想用用SG函数的,没想到这题竟然这么弱,还真得好好分析一下,不能生搬硬套。
-
02013-08-24 13:30:45@
一遍AC
var i,j,k,l,b,n,shou,mo:longint;
wind,lolanv:int64;
a:array[1..100000] of longint;
begin
readln(k);
for i:=1 to k do
begin
wind:=0;
lolanv:=0;
shou:=1;
readln(n);
mo:=n;
readln(b);
for j:=1 to n do read(a[i]);
for l:=1 to n do
begin
if a[shou]<a[mo] then begin
if ((l mod 2=1) and (b=0)) or ((l mod 2=0) and (b=1)) then begin wind:=wind+a[mo]; dec(mo); end;
if ((l mod 2=1) and (b=1)) or ((l mod 2=0) and (b=0)) then begin lolanv:=lolanv+a[mo]; dec(mo); end;
end
else begin
if ((l mod 2=1) and (b=0)) or ((l mod 2=0) and (b=1)) then begin wind:=wind+a[shou]; inc(shou); end;
if ((l mod 2=1) and (b=1)) or ((l mod 2=0) and (b=0)) then begin lolanv:=lolanv+a[shou]; inc(shou); end;
end;
end;
if wind<lolanv then writeln('lolanv')
else writeln('wind');
end;
end. -
02013-07-18 10:30:29@
orz 大神的想法就是不一样!!
-
02012-10-24 21:09:59@
#include
#include
using namespace std;
int k,n,a,x;
int main()
{
cin >> k;
for (k;k>0;k--)
{
cin >> n >> a;
for (int i=1;i -
02010-04-09 19:40:26@
n 为偶数,先取数的人可以保证对方只能拿到奇数编号或是偶数编号的数
先手必胜之前是 Vijos Mini 评测,最后两个数据超时
-
02009-11-16 15:32:19@
#include
using namespace std;
const int N=999999;
int a[N];
int main ()
{
int k,n,n1,d;
scanf("%d",&n);
for (int i=1;i -
02009-10-24 19:29:41@
AC为轻,思路为重
-
02009-10-10 08:39:03@
用C++的同志.
用gets()读 -
02009-10-08 20:06:51@
把所有数分成奇数和偶数 那么总和总有一个是大的
所以第一个人选择取最后一个(偶数组)或者第一个(奇数组)肯定获胜
数相等也是一样 -
02009-10-04 20:03:10@
庆祝!!第60题了
program vijos;
var i,n,m,k:longint;
s:ansistring;
begin
readln(k);
for i:=1 to k do
begin
readln(n);
readln(m);
readln(s);
if m=1 then writeln('lolanv') else writeln('wind');
end;
end. -
02009-09-23 20:06:07@
OTL lolanv的题解,果然有理
博弈论真是简单编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
var
n,k,i:longint;
begin
assign(input,filename+'.in');reset(input);
assign(output,filename+'.out');rewrite(output);
readln(k);
for i:=1 to k do
begin
readln(n);
readln(n);
if odd(n)then writeln('lolanv')else writeln('wind');
readln;
end;
close(input);close(output);
end. -
02009-09-22 17:53:17@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms最后两组数据很强大,光读入就要200+ms,所以改用readln吧,秒杀。