Download - [ACM-ICPC] 1 - Basic
![Page 2: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/2.jpg)
Online Judge
• UVa - uva.onlinejudge.org
• POJ - poj.org
• ZeroJudge - zerojudge.tw
• SPOJ - www.spoj.pl
• USACO - ace.delos.com/usacogate
![Page 3: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/3.jpg)
Online Contest
• Google Code Jam - code.google.com/codejam
• CodeForces - codeforces.com
• TopCoder - www.topcoder.com
• PTC - ptc.moe.edu.tw
![Page 4: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/4.jpg)
Input•多為連續測資(不只⼀一筆)•若未指定測資數量,則讀取至 EOF (end
of file)while ( scanf( “%d”, &x ) != EOF ) {
//do something}
while ( cin >> x ) {//do something
}
![Page 5: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/5.jpg)
Output
•「⼀一定」要按照題目規定輸出•多⼀一個空格、字母、換行等等多餘字元,都算錯!
![Page 6: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/6.jpg)
Example[POJ] 1000 - A+B Problem
#include <iostream>#include <cstdio>#include <cstdlib>using namespace std;int main() { int a, b; while ( ~scanf( "%d %d", &a, &b ) ) printf( "%d\n", a + b ); return 0;}
![Page 7: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/7.jpg)
注意•於 C++ 中使用 scanf/printf 等 function,請引入 cstdio (or stdio.h)
•於 C++ 中使用 atoi/rand 等 function,請引入 cstdlib (or stdlib.h)
•善用好的編輯器(vim, notepad++, Code Block)
![Page 8: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/8.jpg)
Practice[POJ] 1207 - The 3n + 1 problem
![Page 9: [ACM-ICPC] 1 - Basic](https://reader031.vdocuments.pub/reader031/viewer/2022020207/555602fbd8b42a8a5f8b55b6/html5/thumbnails/9.jpg)
Thank You for Your Listening.