Maximum Prime Gap


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 10M

Author:
Problem type

Description

請撰寫一個程式,輸入一個正整數 n,輸出 1 ~ n 之間所有符合以下條件的數字:

  • 不能是 3 的倍數
  • 不能包含數字 3,例如:13、23、30 都不符合

Requirements

  1. 輸入

    • 一個正整數 n
  2. 規則

    • 若數字是 3 的倍數,跳過
    • 若數字中任一位數包含 3,跳過
    • 提示:必須使用 continue
  3. 輸出

    • 將所有符合條件的數字輸出於同一行
    • 以一個空格分隔且最後不可多印空格

Input / Output

Sample 1 Sample 2 Sample 3
INPUT 15 25 5
OUTPUT 1 2 4 5 7 8 10 11 14 1 2 4 5 7 8 10 11 14 16 17 19 20 22 25 1 2 4 5

Comments

There are no comments at the moment.