結果
問題 | No.826 連絡網 |
ユーザー |
![]() |
提出日時 | 2019-05-03 22:47:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 858 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 27,648 KB |
最終ジャッジ日時 | 2024-12-31 18:47:21 |
合計ジャッジ時間 | 5,237 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | WA * 30 |
ソースコード
# coding: UTF-8 import sys #sys.setrecursionlimit(n) import heapq import re import bisect import random import math import itertools from collections import defaultdict, deque from copy import deepcopy from decimal import * def is_prime(n): i = 2 while i * i <= n: if n % i == 0: return False i += 1 return True def prime_table(n): list = [True for _ in range(n + 1)] i = 2 while i * i <= n: if list[i]: j = i + i while j <= n: list[j] = False j += i i += 1 table = [] for i in range(n + 1): if list[i] and i >= 2: table.append(1) else: table.append(0) return table n, p = map(int, input().split()) table = prime_table(n) if is_prime(p): print(1) else: print(n - sum(table[0:n]) + 1)