Friday, 5 August 2016

Jumping on the Clouds: Revisited Hacker Rank Problem Solution.


Solution:

#include <bits/stdc++.h>
using namespace std;
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/
int main() { 
    int n,k,ar[27],energy = 100;
    cin >> n >> k;
    for(int i = 0; i < n; i++)cin >> ar[i];
    for(int i = 0; i < n; i+=k)energy-=(1+2*ar[i]);
    cout << energy << endl;
    return 0;
}

No comments:

Post a Comment