UVA Solution 474 - Heads _ Tails Probability - Solution in C - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Monday, May 22, 2017

UVA Solution 474 - Heads _ Tails Probability - Solution in C

UVA Solution 474 - Heads _ Tails Probability- Volume 4


UVA Online Judge Solution 474 - Heads _ Tails Probability| Volume 4
UVA Problem Link - 474 - Heads _ Tails Probability

Problem Name: 474 - Heads _ Tails Probability solution
Problem Number : UVA - 474 - Heads _ Tails Probability solution
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C

UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list

UVA Solution 474 - Heads _ Tails Probability Code in C:

#include <stdio.h>
#include <math.h>
int main() {
    int n;
    while(scanf("%d", &n) == 1) {
        if(n == 6) {
            puts("2^-6 = 1.562e-2");
            continue;
        }
        int b = (int)floor(log10(2)*(-n));
        printf("2^-%d = %.3lfe%d\n", n, pow(10, log10(2)*(-n)-b), b);
    }
    return 0;
}


Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA Heads _ Tails Probability code in C, UVA 474 - Heads _ Tails Probability code in C++, UVA 474 solution in C, UVA 474 - Heads _ Tails Probabilitysolution

No comments:

Post a Comment