Uva 12555 Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t, j = 1;
    cin >> t;
    while(t--)
    {
        int n, p = 0;
        string s;
        cin >> n >> s;

        for(int i=0;i<s.size();i++)
        {
            if(s[i] >='1' && s[i] <= '9')
                p = s[i] - '0';
        }

        double ans = 0.5*n + 0.05*p;

        cout << "Case " << j++ << ": " << ans << "\n";
    }

    return 0;
}

Comments