codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1076C.md (1140B)


      1 Source: https://codeforces.com/problemset/problem/1076/C
      2 
      3 C. Meme Problem
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Try guessing the statement from this picture:
     22 
     23  ![](https://espresso.codeforces.com/1818bdbefb33915e3dc4c590707e345859fcdd75.png) 
     24 
     25 You are given a non-negative integer $d$. You have to find two non-negative real numbers $a$ and $b$ such that $a + b = d$ and $a \cdot b = d$.
     26 
     27 Input
     28 
     29 The first line contains $t$ ($1 \le t \le 10^3$) — the number of test cases.
     30 
     31 Each test case contains one integer $d$ $(0 \le d \le 10^3)$.
     32 
     33 Output
     34 
     35 For each test print one line.
     36 
     37 If there is an answer for the $i$-th test, print "Y", and then the numbers $a$ and $b$.
     38 
     39 If there is no answer for the $i$-th test, print "N".
     40 
     41 Your answer will be considered correct if $|(a + b) - a \cdot b| \le 10^{-6}$ and $|(a + b) - d| \le 10^{-6}$.
     42 
     43 Example
     44 
     45 Input
     46 
     47 ```
     48 7
     49 69
     50 0
     51 1
     52 4
     53 5
     54 999
     55 1000
     56 ```
     57 
     58 Output
     59 
     60 ```
     61 Y 67.985071301 1.014928699
     62 Y 0.000000000 0.000000000
     63 N
     64 Y 2.000000000 2.000000000
     65 Y 3.618033989 1.381966011
     66 Y 997.998996990 1.001003010
     67 Y 998.998997995 1.001002005
     68 ```