close

原檔連結

1. 行號產生程式---輸入任一英文文字檔案, 輸出經加行號後原始文字檔案及其之程式並另存新檔
範例如
---Input file==>xxx.txt
其內容為:
The web is changing every day.
It is not only a place for nifty web pages,
but also a communication medium
where business can perform daily routines.
---執行如abc 基本上,這題只要找到'\n'然後行數+1,比較困難的是要找到檔案輸入的語法。



2. 檔案內容檢視程式---輸入任一檔案(含文字檔或執行檔或圖檔等各種檔案), 輸出其16進位碼及ASCII對照碼
範例如:
---Input file==>winclose.gif,
---執行如abc 這題跟上一題差不多,只是要找出輸入檔案和抓出程式碼的語法…

3. 月曆程式---輸入西元年月, 輸出其月曆, 注意閏月29及大小月的問題
範例如
---Input arguments(年 月 星期): 2007 6 5
---執行如abc 2007 6 5
---輸出如下
June 2007
S M Tu W Th F S
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

這題第一步是算出是否為閏年、閏月,還有該月的總日數。較難的是找出該月第一天是星期幾。

4. 排列程式---將參數排列
---執行如abc sun mon tue wed thu fri sat
---輸出如下
fri mon sat sun thu tue wed

這題課本上有類似,可以用比大小或二分樹來做。

5. 階乘程式---輸入1~100, 輸出其無誤差之答案

這個…以前做過吧?

6. 列印1至10000的所有快樂數---Find all Happy Numbers between 1 to 10000.
Definition: a positive numer s, let s' be the square sum of all digits of s.
If there exists a subsequent square sum of s which is 1, then s is a happy number, otherwise s is an unhappy number.
for example, 7 is happy number because 7 -> 49 -> 97 ->130 -> 10 -> 1.

那個…快樂數是啥?

7. 列印所有單字---輸入任一英文文字檔案, 輸出所有英文單字不含標點符號
---Input file==>xxx.txt
其內容為:
The web is changing every day.
It is not only a place for nifty web pages,
...
---執行如abc 拿getnextword來改吧,原理差不多。

8. 列印1~100的所有質數
---輸出 2 3 5 7 11 13 ... 97

找出質數的算法公式。

9. 算出所有參數的最大公因數GCD
---執行如abc 12 96 320
---輸出 5

以前寫過=_=

10. 算出所有參數的最小公倍數LCM
---執行如abc 12 96 320
---輸出 800

這個…要找公式。


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 otn147 的頭像
    otn147

    隱狼原

    otn147 發表在 痞客邦 留言(0) 人氣()