1.6编程基础之一维数组(15)

loading 分享 2026-8-10 下载文档

INPUT DETAILS:

The shipment was 14 kilograms of feed, and Farmer John has 4 kilograms left. He had three cows that ate feed for some amount of time in the last 10 days.

OUTPUT DETAILS:

If Farmer John started with 14 kg of feed on day 6, then on days 6 and 7, two kilograms would be eaten each day. On day 8, three kilograms would be eaten. On day 9, two kilograms would be eaten. On day 10, one kilogram would be eaten. Thus, the total eaten would be 2 + 2 + 3 + 2 + 1 = 10, leaving him with 4 kilograms.

来源

USACO 2005 February Silver

13(t1577:Jolly Jumpers)

总时间限制:

1000ms

内存限制:

65536kB

描述

A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance, 1 4 2 3

is a jolly jumper, because the absolutes differences are 3, 2, and 1 respectively. The definition implies that any sequence of a single integer is a jolly jumper. You are to write a program to determine whether or

not each of a number of sequences is a jolly jumper.

输入

Each line of input contains an integer n < 3000 followed by n integers representing the sequence.

输出

For each line of input, generate a line of output saying \

样例输入

4 1 4 2 3 5 1 4 2 -1 6 样例输出

Jolly Not jolly 来源

Waterloo local 2000.09.30


1.6编程基础之一维数组(15).doc 将本文的Word文档下载到电脑
搜索更多关于: 1.6编程基础之一维数组(15) 的文档
相关推荐
相关阅读