We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Implementation
  4. Jumping on the Clouds: Revisited
  5. Discussions

Jumping on the Clouds: Revisited

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • polmki99
    6 years ago+ 11 comments

    3 tight little lines.

    n, k  = map(int, input().strip().split())
    clouds = list(map(int, input().strip().split()))
    print(100 - sum(1 + 2 * clouds[i] for i in range(0, n, k)))
    

    And an unreadable one-liner.

    print((lambda x,y: 100-sum(1+2*y[i] for i in range(0,x[0],x[1])))(list(map(int,input().strip().split())), list(map(int,input().strip().split()))))
    
    19|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature