Advertisement
GastonFontenla

ProblemaC

Nov 13th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int casos, n;
  7.     scanf("%d", &casos);
  8.  
  9.     for(int i=0; i<casos; i++)
  10.     {
  11.         scanf("%d", &n);
  12.  
  13.         if(n != 0 && n < 4)
  14.         {
  15.             printf("N\n");
  16.         }
  17.         else
  18.         {
  19.             double raiz = sqrt(n*(n-4));
  20.             double a = (n+raiz)/2;
  21.             double b = (n-raiz)/2;
  22.             printf("Y %.10f %.10f\n", a, b);
  23.         }
  24.     }
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement