C. Meme Problem

Posted mch5201314

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C. Meme Problem相关的知识,希望对你有一定的参考价值。

链接

[http://codeforces.com/contest/1076/problem/C]

题意

a+b=d and a?b=d. 计算出a和b

分析

ab=a(d-a)=d
aa-ad+d=0; 先判断再直接求根公式

代码

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t,d;
    cin>>t;
    while(t--){
        cin>>d;
        if(d*d-4*d<0) cout<<"N
";
        else{
            cout<<"Y
";
            double a=(d*1.0-sqrt(d*d-4*d))/2.0,b=(d*1.0+sqrt(d*d-4*d))/2.0;
            printf("%.9f %.9f
",a,b);
        }
    }
    return 0;
}

以上是关于C. Meme Problem的主要内容,如果未能解决你的问题,请参考以下文章

CF1076C Meme Problem

CF1288B-Yet Another Meme Problem

Educational Codeforces Round 80. B - Yet Another Meme Problem

Educational Codeforces Round 80 (Rated for Div. 2)(BYet Another Meme Problem)

MEME(Motif-based sequence analysis tools)使用说明

Codeforces Beta Round #2 C. Commentator problem