calculate the distance between N and X


Submit solution

Points: 20
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

題目說明

<1111檢定考題>
設計一程式由鍵盤輸入一個整數資料 N,求與 N 最近的立方數 X,並計算 N 與 X 的距離。

輸入

由鍵盤輸入一個整數資料 N
N 有正有負,最多 7 位數

輸出

求與 N 最近的立方數 X ,計算 N 與 X 的距離後,由螢幕印出 X 及 N 與 X 的距離。

sample input & output

輸入 輸出
樣本1 18 X:27 距離:9
樣本2 345 X:343 距離:2
樣本3 -456 X:-512 距離:56

Comments


  • 1
    scu11156185  commented on Sept. 23, 2024, 1:44 a.m. edited

    你什麼都沒看到


  • 0
    scu10156204  commented on Dec. 8, 2023, 1:58 p.m.

    答案明明是對的,卻顯示錯誤


    • 0
      chiang  commented on Oct. 19, 2024, 3:17 p.m.

      在輸出"距離"兩字前要有一個空格。所有字(包括冒號,我是用copy/paste輸出範例的字)的自型也最好相同,如此才有較大的機率過關。


    • 0
      scu12156136  commented on Jan. 3, 2024, 8:24 p.m.

      樣本距離應該是9