【正文】
C語法: { .... printf(%d\n\n,ans)。 } 2022/2/11 48 輸出 _第三類: ? 一個 Input Block對應(yīng)一個 Output Block,Output Block之間 有 空行。 ? scanf(%d,amp。 ? for(i=0。i++) ? { ? sum=0。n)。jn。a)。 ? } ? if(iicase1) ? printf(%d\n\n,sum)。 ? } ? } 2022/2/11 50 解決辦法: ? C語法: for (k=0。k++) { while (…) { printf( %d\n,result)。 } ? C++語法: 類似,輸出語句換一下即可。 char str[25]。 ? 另外,拷貝程序容易產(chǎn)生錯誤 2022/2/11 54 下面的 hdoj1089為什么 CE? include int main() { int a,b。a, amp。 } 2022/2/11 55 二、小技巧 ? 數(shù)據(jù)的拷貝(特別是輸出的提示信息) ? 調(diào)試的 sample input的拷貝 2022/2/11 56 三、 C語言處理 “ 混合數(shù)據(jù) ” 的問題 例題( Hdoj_1170) 2022/2/11 57 常見的代碼: …… scanf(%d\n,amp。 for (i=0。i++) { scanf(%c%d%d,amp。num1,amp。 …… } …… 2022/2/11 58 有什么問題? 2022/2/11 59 四、 Printf和 cout混用的問題 以下的程序輸出什么? include include int main() { int j=0。j5。 printf(%d\n,j)。 } 2022/2/11 60 為什么? ?一個帶緩沖輸出( cout) ?一個不帶緩沖輸出 (printf) 2022/2/11 61 五、輸入輸出原理 Input 1 5 2 6 10 20 111 111 321 123 Output 6 8 30 222 444 2022/2/11 62 思考題 (目的:初步體會一下 ACM的魅力 ) Given two nonnegative integers m and n, you will have to find the last digit of mn in decimal number system. ? Input ? The input file contains several lines. Each line contains two integers m and n (both less than 101001). Input is terminated by a line containing two zeroes. This line should not be processed. ? Output ? For each set of input you must produce one line of output which contains a single digit. This digit is the last digit of mn. ? Sample Input ? 3 2 ? 3 5 ? 0 0 ? Sample Output ? 9 ? 3 2022/2/11 63 授課方式與成績評定 ?介紹常用算法 ?舉例分析 ?上機(jī)練習(xí)(自己在線練習(xí)) ?成績評定:機(jī)試 ( 5 ~ 6 題 ) 2022/2/11 64 相關(guān)資料 數(shù)學(xué)知識 ? 離散、組合 ? 數(shù)論、圖論 ? 計算幾何 算法 amp。