結果

問題 No.1162 Many Quotients hard
ユーザー umezo
提出日時 2020-08-12 16:16:46
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 425 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,204 ms
コンパイル使用メモリ 210,576 KB
実行使用メモリ 9,868 KB
最終ジャッジ日時 2026-10-29 19:25:49
合計ジャッジ時間 3,355 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 42 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ll n;
  cin>>n;
  
  ll cnt=0,tmp,pre=-1;
  ll t=(sqrt(1+4*n)-1)/2;
  for(ll i=t+1;i*i<=n;i++){
    tmp=n/i;
    if(tmp!=pre){
      cnt++;
      pre=tmp;
    }
  }
  cnt+=t;
  if(n/pre==pre) cout<<2*cnt-1<<endl;
  else cout<<2*cnt<<endl;
 
  return 0;
}
0