發表文章

目前顯示的是 3月, 2009的文章

UVa 10137 The Trip

引用某個解題者的話:This problem IS a trip. 乍看很簡單,但是很容易在浮點數精確度上吃悶虧。 最後我全部轉成int來運算,確保一切在掌握之內。 兩點提醒 1. 平均開銷算出來以後要四捨五入到小數第二位(1 cent) 2. 因為平均開銷不精確,所以exchange amount 要統計兩個,輸出小的那一個。

UVa 10033 Interpreter

蠻有趣的一題,還好距離組語記憶還不算太久。 朝每天至少一題邁進吧。 目前是第二天^+++++^ ps. 雖然我很想以德國人般的嚴謹來面對UVa Online Judge的格式要求。 但常常跟空白、換行對抗感覺不太好...orz ps2. 距離一次AC的目標又進了一步。這題兩次AC。

UVa 706 LCD Display

簡單的問題,但是有些機歪的狀況 摘自UVa forum by kckckc 1. Space or NewLine that have mentioned in previous Post. 2. Maybe the code will meet some problem in some input sets such as input is X 0 3. I didn't handle the leading 0 situation, that means if input is 00007, my out put is 7. 所以下面這是關鍵測資 10 99999999 3 00007 5 0 0 0

UVa 10189 Minesweeper

小題目。 寫完很久了,不知為何忘了放上來。 最近被848 FMT弄得心煩意亂,唉。

[ACM] 常用程式片段

Debug用 #ifndef ONLINE_JUDGE freopen("848_input.txt", "r",stdin); freopen("848_output.txt","w",stdout); #endif 進階版getch(), ungetch() (from K&R) // ungetch(): push a char to stack // getch(): if stack is not empty, pop a char // or get a char from stdin. int buffer[1024]; int top = -1; //stack pointer void ungetch(int c){ buffer[++top] = c; } int getch(){ if(top > -1) return buffer[top--]; else return getchar(); }

最後一天了

不管結果如何,再一天,這樣的日子都要成為過去了。 有一點苦澀,又有一點懷念。