Uva 12992 - Huatuo's Medicine

// Ad-hoc DP
// Accepted

#include<bits/stdc++.h>

using namespace std;

long ar[205];

void bottles()
{
    ar[1]=1;

    for(int i=2;i<=125;i++)
    {
        ar[i] = ar[i-1] + 2;
    }
}

int main()
{
    bottles();

    int t,tc=0;
    cin >> t;

    while(t--)
    {
        int n;
        cin >> n;
        cout << "Case #" << ++tc << ": " << ar[n] << endl;
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number