結果

問題 No.1162 Many Quotients hard
ユーザー 👑 Nachia
提出日時 2020-12-08 19:17:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 398 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 191,320 KB
最終ジャッジ日時 2025-01-16 19:51:25
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0;i<(n);i++)

ULL sqrt_int(ULL x){
  ULL l=0, r=min(2000000000ull,x+1);
  while(r-l>1){
    ULL m=(l+r)/2;
    if(m*m<=x) l=m; else r=m;
  }
  return l;
}

int main(){
  ULL N; cin>>N;
  ULL Q = sqrt_int(N);
  ULL ans=Q*2;
  if(Q*Q==N) ans--;
  cout<<ans<<endl;
  return 0;
}
0