summaryrefslogtreecommitdiff
path: root/1a.c
blob: 725aa451d906838b664eb2c0523c2e3e36842629 (plain)
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
32
33
34
35
36
#include <stdlib.h>
#include <stdio.h>

int main(void)
{
    char buff[80];
    int last = -1;
    int count = 0;
    int data[2000];
    int f,i;

    i = 0;

    for(i = 0; i < 2000; i++)
    {
        fgets(buff, sizeof buff, stdin);
        data[i] = atoi(buff);
    }

    for(f = 0; f < 1998; f++)
    {
        i = data[f] + data[f+1] + data[f+2];

        if (last != -1 && last < i)
        {
            printf("%d\n", i);
            count++;
        }

        last = i;
    }

    printf("count=%d\n", count);

    return 0;
}