COCI '09 Contest 1 #1 Note

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 32M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

C major scale consists of 8 tones: c d e f g a b C. For this task we number the notes using numbers 1 through 8. The scale can be played ascending, from 1 to 8, descending, from 8 to 1, or mixed. Write a program that, given the sequence of notes, determines whether the scale was played ascending, descending or mixed.

Input Specification

First and only line of input will contain 8 integers, from 1 to 8 inclusive. Each integer will appear exactly once in the input.

Output Specification

In the first and only line of input print descending if the scale was played descending, ascending if the scale was played ascending and mixed if the scale was played mixed.

Sample Input 1

1 2 3 4 5 6 7 8

Sample Output 1


Sample Input 2

8 7 6 5 4 3 2 1

Sample Output 2


Sample Input 3

8 1 7 2 6 3 5 4

Sample Output 3



  • -2
    Firebrand  commented on Nov. 12, 2018, 9:09 p.m.

    shouldn't it say "first and only line of output for the output explanation? (just nitpicking)