AI工具人
提示词工程师

codeforces 312


 A. Whose sentence is it?

代码:

//codeforces 312 A
//2013-05-01-19.12
#include <stdio.h>
#include <string.h>

char str[102];
int main()
{
    int n;
    scanf("%d", &n);
    getchar();

    while (n--)
    {
        int f = 0;
        int r = 0;
        gets(str);
        int l = strlen(str);
        if (str[0] == 'm' && str[1] == 'i' && str[2] == 'a' && str[3] == 'o' && str[4] == '.')
            r = 1;
        if (str[l-5] == 'l' && str[l-4] == 'a' && str[l-3] == 'l' && str[l-2] == 'a' && str[l-1] == '.')
            f = 1;
        if ((!f&&!r) || (f && r))
            puts("OMG>.< I don't know!");
        else if (f && !r)
            puts("Freda's");
        else
            puts("Rainbow's");
    }
    return 0;
}

B. Archer

//codeforces 312 B
//2013-05-01-19.51
#include <stdio.h>
const double inf = 0.00000000001;
int main()
{
    double a, b, c, d;
    double sw, zw, sl, zl; // snallr win zanoes win and lost
    while (scanf("%lf %lf %lf %lf", &a, &b, &c, &d) != EOF)
    {
        sw = a/b;
        sl = 1.0 - sw;
        zw = c/d;
        zl = 1.0 - zw;
        double ans = 0;
        double tmp = 1.0;
        while(1)
        {
            ans += tmp*sw;
            tmp = tmp*sl*zl;
            if (tmp < inf)
                break;
        }
        printf("%.12lf\n", ans);
    }
    return 0;
}


赞(0) 打赏
未经允许不得转载:XINDOO » codeforces 312

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫