Advertisement
Saleh127

CF 1426C

Sep 28th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9. test
  10. {
  11.  
  12. ll a,c,d,e,f,i,j,k;
  13. cin>>a;
  14. c=sqrt(a);
  15. d=c-1;
  16. if(c*c==a)
  17. {
  18. d+=c-1;
  19. }
  20. else
  21. {
  22. d+=(a/c);
  23. if(a%c==0) d--;
  24. }
  25. cout<<d<<endl;
  26. }
  27.  
  28.  
  29.  
  30. return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement