26 条题解

  • 2
    @ 2016-02-20 13:41:05

    可以写一个程序,如果目标是[00]则可以从[00]出发,每一次将边缘的一个0变成[00_...]或[..._00]的形式,如此重复n次,找出来答案。这样的方法可以快速给出n比较小的时候(例如n<=25)的答案。

    题解中,JZP已经给出了他找到的结果。
    当第一行为0时(n从3开始):
    2 3 6 9 16 23 34 45 60 75 94 113 136 159 186 213 244 275 ...
    当第二行为1时(一样从3开始):
    2 6 10 18 25 35 45 59 73 91 109 131 153 179 205 235 265 299 ...

    那么规律就不难发现了。

  • 1
    @ 2021-10-12 20:18:33
    #include <iostream>
    #include <cstring>
    #include <cstdlib>
    #include <stdio.h>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <set>
    #include <map>
    #include <string>
    #include <math.h>
    #include <stdlib.h>
    #include <iomanip>
    #include <list>
    #include <deque>
    #include <stack>
    #define ull unsigned long long
    #define ll long long
    #define mod 90001
    #define INF 0x3f3f3f3f
    #define maxn 10000+10
    #define cle(a) memset(a,0,sizeof(a))
    const ull inf = 1LL << 61;
    const double eps=1e-5;
    using namespace std;
    priority_queue<int,vector<int>,greater<int> >pq;
    struct Node{
    int x,y;
    };
    struct cmp{
    bool operator()(Node a,Node b){
    if(a.x==b.x) return a.y> b.y;
    return a.x>b.x;
    }
    };
    
    bool cmp(int a,int b){
    return a>b;
    }
    ull a[1000015];
    ull b[1000015];
    int main()
    {
    #ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
    #endif
    //freopen("out.txt","w",stdout);
    int x,n;
    a[1]=2,a[2]=3;
    b[1]=2,b[2]=6,b[3]=10,b[4]=18,b[5]=25;
    ull tmp=3;
    for(int i=3;i<=1000010;i++){
    a[i]=a[i-1]+tmp;
    if(i%2==0)tmp+=4;
    }
    tmp=10;
    for(int i=6;i<=1000010;i++){
    b[i]=b[i-1]+tmp;
    if(i&1)tmp+=4;
    }
    //cout<<a[1000010]<<" "<<b[1000010]<<endl;
    while(cin>>x){
    while(cin>>n){
    if(x==0)cout<<a[n-2]<<endl;
    else cout<<b[n-2]<<endl;
    }
    }
    return 0;
    }
    

    QWQ不是太难

  • 1
    @ 2021-10-12 20:17:38

    什么题

  • 1
    @ 2016-02-20 14:22:34

    终于过了.他说的是输入若干行...得用while(cin>>n)但是样例中就一个3容易误导
    ```
    /* ***********************************************
    Author :guanjun
    Created Time :2016/2/19 14:36:33
    File Name :vijosp1435.cpp
    ************************************************ */
    #include <iostream>
    #include <cstring>
    #include <cstdlib>
    #include <stdio.h>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <set>
    #include <map>
    #include <string>
    #include <math.h>
    #include <stdlib.h>
    #include <iomanip>
    #include <list>
    #include <deque>
    #include <stack>
    #define ull unsigned long long
    #define ll long long
    #define mod 90001
    #define INF 0x3f3f3f3f
    #define maxn 10000+10
    #define cle(a) memset(a,0,sizeof(a))
    const ull inf = 1LL << 61;
    const double eps=1e-5;
    using namespace std;
    priority_queue<int,vector<int>,greater<int> >pq;
    struct Node{
    int x,y;
    };
    struct cmp{
    bool operator()(Node a,Node b){
    if(a.x==b.x) return a.y> b.y;
    return a.x>b.x;
    }
    };

    bool cmp(int a,int b){
    return a>b;
    }
    ull a[1000015];
    ull b[1000015];
    int main()
    {
    #ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
    #endif
    //freopen("out.txt","w",stdout);
    int x,n;
    a[1]=2,a[2]=3;
    b[1]=2,b[2]=6,b[3]=10,b[4]=18,b[5]=25;
    ull tmp=3;
    for(int i=3;i<=1000010;i++){
    a[i]=a[i-1]+tmp;
    if(i%2==0)tmp+=4;
    }
    tmp=10;
    for(int i=6;i<=1000010;i++){
    b[i]=b[i-1]+tmp;
    if(i&1)tmp+=4;
    }
    //cout<<a[1000010]<<" "<<b[1000010]<<endl;
    while(cin>>x){
    while(cin>>n){
    if(x==0)cout<<a[n-2]<<endl;
    else cout<<b[n-2]<<endl;
    }
    }
    return 0;
    }

  • 1
    @ 2009-06-07 11:18:18

    不是好题

    缺乏算法框架

    跟浙江09省选一试第一题有的一拼

  • 0
    @ 2017-11-04 20:20:07

    看得有点懵逼。。。还是我太菜了

  • 0
    @ 2009-07-09 20:01:23

    沙茶题留名……

  • 0
    @ 2009-06-14 22:39:23

    囧掉了……分数从0到50再到100……

    0:输入m输错了……

    50:差了一个halt没改成exit……

    100:终于搞定了……

    一道找规律的题……汗死……

  • 0
    @ 2009-06-01 14:06:52

    分享我的程序找出的规律:

    当第一行为0时(n从3开始):

    2 3 6 9 16 23 34 45 60 75 94 113 136 159 186 213 244 275 ...

    当第二行为1时(一样从3开始):

    2 6 10 18 25 35 45 59 73 91 109 131 153 179 205 235 265 299 ...

    规律自己看吧,注意要用qword。

    p.s. 我和楼下是同一个人,但是我先AC……

  • 0
    @ 2009-05-29 15:21:08

    数据组数不超过9

    AC的才1个人,就有了17个人的题解...

  • 0
    @ 2009-05-29 14:11:52

    没看懂题

  • 0
    @ 2009-06-06 13:02:00

    oimaster的小号!看来他囧掉了。

    第二次改成通项的了

  • 0
    @ 2009-05-27 20:12:37

    题目解释得太不清楚了,看不懂...

  • 0
    @ 2009-05-26 16:54:00

    根本看不懂题

  • 0
    @ 2009-05-26 09:47:32

    哦。。福建第三题啊。 。。

    说简单的请不要说你打表出来的。。请证明

  • 0
    @ 2009-05-25 20:55:05

    唉,这题是我一生的痛啊,要不是我考试的时候傻逼去写高精,我就进了。。。结果让给了PZY。。。。。。囧。。。。

  • 0
    @ 2009-05-25 19:54:30

    没看懂...

  • 0
    @ 2009-05-30 18:11:03

    小号速递:

    这道题范围2

  • 0
    @ 2009-05-25 15:07:59

    题目乱七八糟[/red],最好改改,数据也加上。。

  • 0
    @ 2009-05-25 15:07:14

    题目描述不清,而且没有范围

信息

ID
1542
难度
5
分类
递推 点击显示
标签
递交数
236
已通过
78
通过率
33%
被复制
4
上传者