結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー mudbdbmudbdb
提出日時 2016-08-06 00:01:29
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 648 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:03:24
合計ジャッジ時間 5,912 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 11 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 0 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 0 ms
5,376 KB
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 0 ms
5,376 KB
testcase_18 AC 0 ms
5,376 KB
testcase_19 AC 65 ms
5,376 KB
testcase_20 AC 295 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 0 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 0 ms
5,376 KB
testcase_25 AC 581 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 0 ms
5,376 KB
testcase_28 AC 0 ms
5,376 KB
testcase_29 AC 0 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 0 ms
5,376 KB
testcase_32 AC 216 ms
5,376 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 515 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:33:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |   scanf("%d %d",&N,&L);
      |   ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int Pr(int n) {
  int e = 0;
  int p;
  if (n%2 == 0) {
    e++;
    n/=2;
    if (n%2 == 0) {
      return 0;
    }
  }
  for (p=3; p*p<=n; p+=2) {
    if (n%p == 0) {
      if (e >= 1) {
        return 0;
      }
      e++;
      n/=p;
      if (n%p == 0) {
        return 0;
      }
    }
  }
  if (n != 1) {
    if (e >= 1) {
      return 0;
    }
  }
  return 1;
}
int main() {
  int N,L;
  scanf("%d %d",&N,&L);
  int i;
  long long int M = 0;
  if (2 <= L/(N-1)) {
    M += (L - 2*(N-1) + 1);
  }
  for (i=3; i<=L/(N-1); i+=2) {
    if (Pr(i)) {
      M += (L - i*(N-1) + 1);
    }
  }
  printf("%lld\n",M);
  return 0;
}
0