Kiểm tra số nguyên tố

View as PDF

Points: 3 (p) Time limit: 1.0s Memory limit: 256M Input: stdin Output: stdout

Bài 4: Kiểm tra số nguyên tố

  • Mô tả: Kiểm tra số \(N\) có phải là số nguyên tố hay không.
  • Yêu cầu: Xuất YES nếu là số nguyên tố, ngược lại NO.
  • Dữ liệu vào: \(1 \le N \le 10^9\).
  • Dữ liệu ra: YES hoặc NO.
  • Ví dụ: Vào 7 -> Ra YES.
  • Ràng buộc: Tối ưu vòng lặp đến \(\sqrt{N}\).

Comments

Most recent
Loading comments...

There are no comments at the moment.