All pastes #330948 Raw Edit

Unnamed

public cpp v1 · immutable
#330948 ·published 2007-01-28 12:35 UTC
rendered paste body
#include <iostream>using namespace std;int main(){        int _T; scanf("%d", &_T);        while(_T--) {                int W, B, C; scanf("%d %d %d", &W, &B, &C);                if(C == 1) {                        printf("%.3f\n", ((float)W)/(W+B));                } else if(W == 0) {                        printf("0.000\n");                } else {                        if(W < C) {                                printf("%.3f\n", ((float)W)/C);                        } else {                                double first = ((double)(C-1))/C;                                double second = ((double)(W-C+1));                                double third = ((W-C+1+B)*C);                                printf("%lf %lf\n", first, second/third);                                printf("%.3lf\n", first+second/third);                        }                }        }        return 0;}