結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 0w10w1
提出日時 2016-11-27 17:50:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 1,000 ms
コード長 487 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 168,716 KB
実行使用メモリ 47,036 KB
最終ジャッジ日時 2023-08-22 06:42:04
合計ジャッジ時間 4,834 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 12 ms
7,368 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 254 ms
45,440 KB
testcase_06 AC 110 ms
25,572 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 12 ms
7,632 KB
testcase_20 AC 39 ms
15,712 KB
testcase_21 AC 15 ms
8,760 KB
testcase_22 AC 13 ms
7,828 KB
testcase_23 AC 24 ms
11,548 KB
testcase_24 AC 41 ms
15,844 KB
testcase_25 AC 96 ms
24,624 KB
testcase_26 AC 102 ms
24,732 KB
testcase_27 AC 8 ms
6,124 KB
testcase_28 AC 28 ms
12,544 KB
testcase_29 AC 91 ms
23,952 KB
testcase_30 AC 11 ms
7,032 KB
testcase_31 AC 100 ms
20,716 KB
testcase_32 AC 90 ms
24,272 KB
testcase_33 AC 272 ms
46,972 KB
testcase_34 AC 291 ms
47,036 KB
testcase_35 AC 232 ms
43,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;

signed main(){
  int N, L; cin >> N >> L;
  vector< int > np( L );
  vector< int > pt;
  for( int i = 2; i < L; ++i )
    if( not np[ i ] ){
      pt.emplace_back( i );
      for( int j = i + i; j < L; j += i )
        np[ j ] = 1;
    }
  ll ans = 0;
  for( int i = 0; i < pt.size(); ++i ){
    ll len = 1LL * pt[ i ] * ( N - 1 );
    if( len <= L )
      ans += L - len + 1;
  }
  cout << ans << endl;
  return 0;
}
0