fork download
  1. program killer;
  2. var
  3. K, N, T, test : LongInt;
  4. ans : AnsiString;
  5.  
  6. begin
  7. {
  8.   uncomment the two following lines if you want to read/write from files
  9.   assign(input, 'input.txt'); reset(input);
  10.   assign(output, 'output.txt'); rewrite(output);
  11. }
  12.  
  13. ReadLn(T);
  14. for test:=1 to T do begin
  15. ReadLn(N, K);
  16.  
  17. ans := '';
  18.  
  19. if (N=K*(K+1) div 2) or (N=K*(K+1) div 2 +1) or (K=1) then ans:='YES'
  20. else ans:='NO';
  21.  
  22.  
  23. WriteLn(ans);
  24. end;
  25.  
  26. end.
  27.  
Success #stdin #stdout 0s 5268KB
stdin
5
100 12
92 13
1000 60
1000 10
420 69

stdout
NO
YES
NO
NO
NO