[問題] 用Java寫ACM題目,輸入的問題

看板java作者 (星演)時間19年前 (2006/02/25 12:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/5 (看更多)
最近在練習用Java寫程式,就找了一題簡單的ACM第476題來解解看. code如下 http://140.116.5.200/~p7694410/ACM476.txt 答案應該沒錯,程式submit前我也把public class的public去掉了 ,但還是出現compile error 後來看ACM寫到submit Java有它的限制: http://online-judge.uva.es/board/viewtopic.php?t=7429 摘錄: The Java programs submitted must be in a single source code (not .class) file. Really, they are compiled and run as native applications using the gcj compiler. They must read and write the standard input/output, as the other languajes. Note that java::io use is restricted; this implies that some features (for example, to create a DataInputStream variable with System.in as argument, in order to use readLine to read strings from the standard input) are not available. 所以我的code會compile error是因為用System.in及readLine的原故, 我對Java還不是很熟... 想請教一下各位高手我該怎麼修改輸入的寫法? 才能通過ACM java compiler的考驗, 另外想請教ACM的Java compiler:gcj也同步支援到jdk5.0嗎? 感謝回答.. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.246.39
文章代碼(AID): #13_zhl8v (java)
文章代碼(AID): #13_zhl8v (java)