PIB '20 P1 - Marcus and Head Bonks

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 0.5s
Memory limit: 128M

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

Marcus loves giving out hugs. Each day, there are N people that Marcus can choose to hug or not. Person i will have a cuteness value of v_i. Marcus is a picky hugger, and only wishes to hug people with a positive cuteness value. Otherwise, if you have a non-positive cuteness value, he will only give you a head pat (which hurts). Can you determine how many people Marcus will hug by the end of the day?

Input Specification

The first line will contain the integer N (1 \le N \le 100).

The next line will contain N integers, v_i (-100 \le v_i \le 100), the cuteness value of person i.

Output Specification

Output the number of people Marcus will hug.

Sample Input

-1 -5 3 2 0

Sample Output


Explanation For Sample

Only person 3 and person 4 have a positive cuteness value, so Marcus will hug only them.


  • 16
    piddddgy  commented on March 18, 2020, 3:34 p.m.

    my headpats are great idk what ur talking about

    • 3
      p1geon  commented on March 19, 2020, 1:09 a.m.