hiho week 30 register

Ended

Participants:387

Verdict:Accepted
Score:100 / 100
Submitted:2015-01-27 20:05:01

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include<stdio.h>
#include<algorithm>
#include<sstream>
#include<string.h>
using namespace std;
const int N = 100001;
short value[N];
short result1[N];
short result2[N];
int n;
bool r1;
bool r2;
ostringstream negativeString;
ostringstream positiveString;
void work()
{
    r1 = r2 = true;
    result1[1] = 1;
    result2[1] = 0;
    for(int i = 2; i <= n; i++)
    {
        if(r1)
        {
            result1[i] = value[i - 1] - result1[i - 1] - result1[i - 2];
            if(result1[i] != 0 &&  result1[i] != 1)
                r1 = false;
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX