240 条题解

  • 0
    @ 2008-10-19 19:09:06

    ^斐波那契数列的兔子问题而已~小小的Bug~2次才AC~第一次写了20多行☞20分,结果第二次程序仅8行就AC吖(晕)

    var

    a,b,t,i,n:longint;

    begin

    readln(n);

    a:=1; b:=1;

    for i:=3 to n do begin t:=a; a:=(a+b) mod 7654321; b:=t; end;

    writeln(a);

    end.

  • 0
    @ 2008-10-17 16:39:33

    “舒畅”同学,你重复输出了!!

  • 0
    @ 2008-10-15 22:02:14

    用记忆化搜索 完全可以过的 不会超时 :)

  • 0
    @ 2008-10-15 17:41:39

    编译通过...

    ├ 测试数据 01:答案错误...程序输出比正确答案长

    ├ 测试数据 02:答案错误...程序输出比正确答案长

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    为什么??

  • 0
    @ 2008-10-12 16:19:44

    /*为C语言竞赛发展添一分力

    使用动态规划(我用的方法不传统,参考价值低一点)

    思路

    政治-》历史|-》政治|-》历史...

    | |-》历史...

    |-》地理|-》历史...

    |-》综合...

    i=0 ...

    pol[1]=1

    i=1

    pol[0]=1

    his[0]=1

    i=2

    pol[1]=2

    geo[1]=2

    i=3

    ...

    每种学科在第i次的考试次数为pol,geo...。

    因为第i次和第i-1次数据不能覆盖,所以设一数组[2]。

    因为long long盛不下那么大数(8,9,10组数据)。

    pol,geo...要每次保留余数。(这个一定要记住)

    想一想n%2,为何?

    */

    #include

    #include

    int main(void)

    {

    long long pol[2],his[2],all[2],geo[2];

    long long modd;

    int n;

    int i,t=0,tt;

    memset(pol,0,sizeof(pol));

    memset(his,0,sizeof(his));

    memset(all,0,sizeof(all));

    memset(geo,0,sizeof(geo));

    scanf("%d",&n);

    pol[1]=1;

    for(i=0;i

  • 0
    @ 2008-10-11 21:41:48

    const inf=7654321;

    var

    f:array[0..1,1..4] of int64;

    n,i,cur,j:longint;

    begin

    readln(n);

    f[1,1]:=1;

    for i:=1 to n-1 do

    begin

    cur:=i and 1;

    for j:=1 to 4 do

    begin

    if f[cur,j]>inf then f[cur,j]:=f[cur,j] mod inf;

    case j of

    1:inc(f[(cur+1)and 1,2],f[cur,j]);

    2:begin inc(f[(cur+1)and 1,1],f[cur,j]); inc(f[(cur+1)and 1,3],f[cur,j]); end;

    3:begin inc(f[(cur+1)and 1,2],f[cur,j]); inc(f[(cur+1)and 1,4],f[cur,j]); end;

    4:inc(f[(cur+1)and 1,3],f[cur,j]);

    end;

    end;

    fillchar(f[cur],sizeof(f[cur]),0);

    end;

    writeln((f[n and 1,1]+f[n and 1,2]+f[n and 1,3]+f[n and 1,4]) mod inf);

    end.

    习惯性的用了滚。。。

  • 0
    @ 2008-10-11 00:49:27

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

    斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契斐波拉契

  • 0
    @ 2008-10-08 18:11:45

    我们可以把历史和地理看作大兔子,政治综合看作小兔子,大兔子历史还是大兔子地理,或小兔子政治。大兔子地理还是大兔子历史,或小兔子综合。所以就越来越多了~~~~~所以叫兔子问题~~~~~~~

  • 0
    @ 2008-10-05 12:39:48

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:运行超时...

    ├ 测试数据 08:运行超时...

    ├ 测试数据 09:运行超时...

    ├ 测试数据 10:运行超时...

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

    Unaccepted 有效得分:60 有效耗时:0ms

    var

    ans:longint;

    n:integer;

    procedure dfs(i,j:integer);

    begin

    if i=n then begin ans:=(ans+1) mod 7654321; exit; end;

    if j=1 then dfs(i+1,2);

    if j=2 then begin dfs(i+1,1); dfs(i+1,3); end;

    if j=3 then begin dfs(i+1,2); dfs(i+1,4); end;

    if j=4 then dfs(i+1,3);

    end;

    begin

    readln(n);

    dfs(1,1);

    writeln(ans);

    end.

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

    var

    a,b,t,i,n:longint;

    begin

    readln(n);

    a:=1;

    b:=1;

    for i:=3 to n do

    begin

    t:=a;

    a:=(a+b) mod 7654321;

    b:=t;

    end;

    writeln(a);

    end.

  • 0
    @ 2008-10-02 12:03:34

    斐波那契数列

    //---|---|---|---|---|---|---|--

    //Program by CK

    //Vijos 1093

    //Oct.2nd

    //---|---|---|---|---|---|---|--

    #include

    main(){

    int x=1,y=1,t,n;

    scanf("%d",&n);

    for(int a=3;a7654321)?((x+y)%7654321):(x+y),x=t>7654321?(t%7654321):t,a++){}

    printf("%d",y);

    }

  • 0
    @ 2008-09-30 14:24:35

    太水

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2009-07-06 20:29:35

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

    这就是我们老菲的数列,小学生都知道的

    1, 1, 2, 3, 5, 8 。。。

  • 0
    @ 2008-09-27 20:46:37

    我好像是直接反推的

    也很快

    f:=f;

    f:=f;

    f:=f+f;

    f:=f+f;

    每次取模很重要

  • 0
    @ 2008-09-25 19:19:59

    看懂题后就是一道简单的斐波那契数列

  • 0
    @ 2008-09-24 21:13:39

    var a:array[1..10000] of longint;

    n,i:integer;

    begin

    readln(n); a[1]:=1; a[2]:=1;

    for i:=3 to n do a[i]:=(a+a) mod 7654321;

    writeln(a[n]);

    end.

    水题!!!!!!!!!!!!!

  • 0
    @ 2008-09-24 09:00:23

    #include

    int main(){

    int n,i;

    long x[10001];

    scanf("%d",&n);

    x[1]=1;

    x[2]=1;

    for (i=3;i

  • 0
    @ 2008-09-23 15:51:49

    3遍啊!!!这种水题

    readln(n);

    a[1]:=1;

    a[2]:=1;

    a[3]:=1;

    for i:=3 to n do

    begin

    a[3]:=a[1]+a[2];

    a[3]:=a[3] mod 7654321;

    a[1]:=a[2];

    a[2]:=a[3];

    end;

    writeln(a[3]);

  • 0
    @ 2008-09-14 20:14:11

    肥不拉机

  • 0
    @ 2008-09-12 19:34:13

    var

    a:array[1..1000000]of longint;

    n,i:longint;

    begin

    readln(n);

    a[1]:=1;

    a[2]:=1;

    for i:=3 to n do

    a[i]:=a+a;

    a[i]:=a[i] mod 7654321;

    write(a[n]);

    end.

  • 0
    @ 2008-09-12 17:11:11

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

    很水的题。斐波那契数列。f[n]=f[n-1]+f[n-2]

    本来想用通项公式直接求,不过后来请教了LBN神牛后发现公式太麻烦了,于是用了递推,结果……

    注意:每次加的时候都要取MOD,这样可以在longint范围内解决

信息

ID
1093
难度
4
分类
模拟 点击显示
标签
(无)
递交数
6521
已通过
2835
通过率
43%
被复制
13
上传者