MWC '15 #7 P1: Sequences

View as PDF

Submit solution

Points: 4
Time limit: 2.0s
Memory limit: 256M

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

kushanzaveri loves sequences. However, he finds that the grade 11 categorizations of sequences are too easy.

Sequences have 4 categories:

  • Arithmetic: Consecutive terms have a constant difference.
  • Geometric: Consecutive terms have a constant factor (multiple)
  • Both: Both an arithmetic and geometric sequence
  • Random: Not an arithmetic nor geometric sequence

kushanzaveri says:

Categorizing a sequence is an easy P1 of a contest

Input Specification

Input will initiate with a single integer N (3 \le N \le 10), the number of elements in the sequence.

The second line will contain N integers, E_n, the nth element. (-1000 \le E_n \le 1000).

Output Specification

arithmetic, geometric, both, or random depending on the type of sequence.

Sample Input 1

1 3 9 27

Sample Output 1


Sample Input 2

-1 2 -3 4 -5

Sample Output 2



  • 1
    BamTargetShock  commented on Nov. 8, 2019, 7:26 p.m.

    Does anyone know what Test Case #3 is? I got all AC except for that one.

  • -5
    XTTH  commented on Feb. 14, 2019, 7:40 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.

    • 2
      kingW3  commented on Feb. 15, 2019, 6:18 a.m.

      It depends on definition but it is 0,0\cdot 2,0\cdot 2^2,0\cdot 2^3