結果

問題 No.2829 GCD Divination
ユーザー kazuppakazuppa
提出日時 2024-08-02 21:37:12
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,660 bytes
コンパイル時間 6,178 ms
コンパイル使用メモリ 338,024 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-02 21:37:20
合計ジャッジ時間 7,608 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,376 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++)
#define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define moda 998244353LL
#define modb 1000000007LL
#define dai 2500000000000000000LL
#define tyu 2500000000
#define sho -dai
#define eps 1e-14
#define yn(x) cout<<(x ? "Yes":"No")<<endl;
#define YN(x) cout<<(x ? "YES":"NO")<<endl;
using it=long long;
using ll=long long;
using un=unsigned long long;
using db=long double;
using st=string;
using ch=char;
using bo=bool;
using P=pair<it,it>;
using mint=modint;
using vi=vector<it>;
using vd=vector<db>;
using vs=vector<st>;
using vc=vector<ch>;
using vb=vector<bo>;
using vp=vector<P>;
using vm=vector<mint>;
using sp=set<P>;
using ss=set<st>;
using sc=set<ch>;
using si=set<it>;
using vvi=vector<vi>;
using vvd=vector<vd>;
using vvs=vector<vs>;
using vvb=vector<vb>;
using vvc=vector<vc>;
using vvp=vector<vp>;
using vvm=vector<vm>;
using vsi=vector<si>;
using vsp=vector<sp>;
using vvsi=vector<vsi>;
using vvsp=vector<vsp>;
using vvvi=vector<vvi>;
using vvvd=vector<vvd>;
using vvvvi=vector<vvvi>;

it sqrt(it n){
  it ok=0,ng=1000000000;
  while(ng-ok>1){
    it kari=(ng+ok)/2;
    if(kari*kari<=n)ok=kari;
    else ng=kari;
  }
  return ok;
}

int main(){
  it n;cin>>n;
  it k=n;
  vd yak;
  rep(i,2,sqrt(k)){
    it ima=1;
    while(k%i==0){
      k/=i;
      ima*=i;
    }
    if(ima!=1)yak.push_back(i);
  }
  if(k!=1)yak.push_back(k);
  db ans=0;
  for(db i:yak)
    ans+=n/(n-n/i);
  cout<<fixed<<setprecision(30);
  cout<<ans<<endl;
}
0