結果

問題 No.3035 2018
ユーザー beetbeet
提出日時 2019-04-01 14:58:52
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 283 ms / 2,000 ms
コード長 674 bytes
コンパイル時間 1,873 ms
コンパイル使用メモリ 197,724 KB
実行使用メモリ 81,576 KB
最終ジャッジ日時 2023-08-16 13:08:04
合計ジャッジ時間 5,838 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 260 ms
81,520 KB
testcase_01 AC 260 ms
81,540 KB
testcase_02 AC 265 ms
81,460 KB
testcase_03 AC 277 ms
81,532 KB
testcase_04 AC 273 ms
81,476 KB
testcase_05 AC 276 ms
81,524 KB
testcase_06 AC 281 ms
81,576 KB
testcase_07 AC 270 ms
81,540 KB
testcase_08 AC 283 ms
81,468 KB
testcase_09 AC 277 ms
81,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
const int MAX = 1e7;
int dp[MAX]={};
int ok[MAX]={};

signed main(){
  for(int i=2;i<MAX;i++)
    if(!dp[i]) for(int j=i;j<MAX;j+=i) dp[j]=i;
  int n;
  cin>>n;
  for(int i=2;i<MAX;i++){
    if(dp[i/dp[i]]==i/dp[i]&&i/dp[i]!=dp[i]) ok[i]=1;
    if(i/dp[i]==(long long)dp[i]*dp[i]) ok[i]=1;
  }
  
  for(int i=2;i<MAX;i++){
    if(!ok[i]) continue;
    n--;
    if(n==0){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}
0