题解

133 条题解

  • 0
    @ 2007-10-08 00:21:18

    要写上证明啊~不然就写个先取者胜等于让大家cheat...

    另外我很好奇那些不是0ms的ac是怎么回事…………

    看来我数据还不够强…………

    ---|---|---|---|---|---|---|-

    题解都写的不错~呵呵~

    再创通过率新高…… - -

    ---|---|---|---|---|---|---|-

    为什么大家的程序都定义了那么多个变量啊?

    标程里是只有1个变量的。。 也是全0ms吖。

  • -1
    @ 2016-09-08 16:21:38

    为什么getline和getchar()差别那么大,前者T2个点,后者AC
    泥萌可以看到我的代码中的iostream和string还没去掉呢
    C++
    #include<cstdio>
    #include<string>
    #include<iostream>
    #include<cctype>
    using namespace std;
    int readint(){
    char c=getchar();
    while(!isdigit(c))c=getchar();
    int p=0;
    while(isdigit(c)){
    p=p*10+c-'0';
    c=getchar();
    }
    return p;
    }
    int main(){
    int k;
    string s;
    k=readint();
    while(k--){
    int n;
    n=readint();
    n=readint();
    getchar();
    getchar();
    char c='0';
    while(c!='\n')c=getchar();
    if(n==0)puts("wind");else
    puts("lolanv");
    }
    }

  • -1
    @ 2016-07-15 19:24:15

    多余的废物不用输入!

  • -1
    @ 2015-03-30 22:21:25

    好阴险的题。。果断dp超时

  • -1
    @ 2015-02-02 13:44:03

    洒家用的是动规算法,极其高大上。最后只是超时了。没想到竟然这么简单。真是智者千虑,必有一失。
    动规思路:定义f(i,j)表示从i到j这些个数字之间先手所赢的分数(比后手高出的分数)。

    f(i,j)=a[j]-f(i,j-1) 表示取第j个数对我的好处
    或者是f(i,j)=a[i]-f(i+1,j) 表示 取第i个数对我的好处
    当然要取两者中的最大值。
    因为空间太大,所以用了滚动数组。最后还是超时了。不过这是很好的思路。虽然这是错误的。

    记录信息
    评测状态 Time Limit Exceeded
    题目 P1281 Easy Selection
    递交时间 2015-02-02 13:31:10
    代码语言 C++
    评测机 VijosEx
    消耗时间 4428 ms
    消耗内存 1264 KiB
    评测时间 2015-02-02 13:31:13
    评测结果
    编译成功

    测试数据 #0: Accepted, time = 0 ms, mem = 1256 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 1256 KiB, score = 10
    测试数据 #2: Accepted, time = 15 ms, mem = 1260 KiB, score = 10
    测试数据 #3: Accepted, time = 15 ms, mem = 1264 KiB, score = 10
    测试数据 #4: Accepted, time = 62 ms, mem = 1260 KiB, score = 10
    测试数据 #5: Accepted, time = 280 ms, mem = 1264 KiB, score = 10
    测试数据 #6: TimeLimitExceeded, time = 1014 ms, mem = 1264 KiB, score = 0
    测试数据 #7: TimeLimitExceeded, time = 1014 ms, mem = 1252 KiB, score = 0
    测试数据 #8: TimeLimitExceeded, time = 1014 ms, mem = 1252 KiB, score = 0
    测试数据 #9: TimeLimitExceeded, time = 1014 ms, mem = 1256 KiB, score = 0
    TimeLimitExceeded, time = 4428 ms, mem = 1264 KiB, score = 60
    代码
    #include<iostream>
    #include<string.h>
    using namespace std;
    int a[100005];
    int f[100005];
    int size;
    int who;
    void go(){
    int i,j;
    for (i = size - 1; i >= 0; i--){
    f[i]= a[i];
    for (j = i+1; j<size;j++){
    int one = a[j]-f[j-1];
    int two = a[i]-f[j];
    if (one > two)f[j] = one;
    else f[j] = two;
    }
    }
    }
    int main(){
    //freopen("in.txt", "r", stdin);

    char name[][10] = { "wind", "lolanv" };
    int t;
    cin >> t;
    while (t-- > 0){
    cin >> size >> who;
    int i;
    for (i = 0; i < size; i++){
    cin >> a[i];
    }
    memset(f, 0, sizeof(f));
    go();
    if (f[size-1] >= 0){
    cout << name[who] << endl;
    }
    else cout << name[1 - who] << endl;
    }
    return 0;
    }

  • -1
    @ 2014-01-23 01:39:39

    刚看完论文,想用用SG函数的,没想到这题竟然这么弱,还真得好好分析一下,不能生搬硬套。

  • -1
    @ 2013-07-18 10:30:29

    orz 大神的想法就是不一样!!

  • -1
    @ 2012-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

  • -1
    @ 2009-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

  • -1
    @ 2009-10-24 19:29:41

    AC为轻,思路为重

  • -1
    @ 2009-10-10 08:39:03

    用C++的同志.

    用gets()读

  • -1
    @ 2009-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.

  • -1
    @ 2009-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吧,秒杀。

信息

ID
1281
难度
3
分类
博弈论 点击显示
标签
(无)
递交数
1764
已通过
900
通过率
51%
被复制
4
上传者