Advertisement
Arden

Quest E (December 2012)

Dec 8th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.65 KB | None | 0 0
  1. //Задача E
  2. program Morgana;
  3. var a:string;
  4. input,output: text;
  5. i,j,K,K1,K2:integer;
  6. S,P: real;
  7. m:array [1..10000]of real;
  8. BEGIN;
  9. Assign(input,'input.txt');
  10. Assign(output, 'output.txt');
  11. Reset(input);
  12. Readln(input,K,S);
  13. ReWrite(output);
  14. P:=K*S;
  15. K1:=K;
  16. FOR i:=1 TO K DO Read(input,m[i]);
  17. Close(input);
  18.  
  19. FOR i:=1 TO K DO
  20. Begin;
  21.       If K1=0 then break;
  22.       K2:=K1;
  23.       K1:=K;
  24.       FOR j:=1 TO K DO
  25.             if m[j]<S then K1:=K1-1;
  26.       if K1<>0 then S:=P/K1;
  27.      
  28. End;
  29.  
  30. If K1>0 then
  31. Begin;
  32. Writeln(output,'YES');
  33. Write(output,S);
  34. END
  35. else
  36. Begin;
  37. Writeln(output,'NO');
  38. Write(output,P/K2);
  39. End;
  40. Close(output)
  41. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement