[acm-icpc] 1 - basic
TRANSCRIPT
Online Judge
• UVa - uva.onlinejudge.org
• POJ - poj.org
• ZeroJudge - zerojudge.tw
• SPOJ - www.spoj.pl
• USACO - ace.delos.com/usacogate
Online Contest
• Google Code Jam - code.google.com/codejam
• CodeForces - codeforces.com
• TopCoder - www.topcoder.com
• PTC - ptc.moe.edu.tw
Input•多為連續測資(不只⼀一筆)•若未指定測資數量,則讀取至 EOF (end
of file)while ( scanf( “%d”, &x ) != EOF ) {
//do something}
while ( cin >> x ) {//do something
}
Output
•「⼀一定」要按照題目規定輸出•多⼀一個空格、字母、換行等等多餘字元,都算錯!
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;}
注意•於 C++ 中使用 scanf/printf 等 function,請引入 cstdio (or stdio.h)
•於 C++ 中使用 atoi/rand 等 function,請引入 cstdlib (or stdlib.h)
•善用好的編輯器(vim, notepad++, Code Block)
Practice[POJ] 1207 - The 3n + 1 problem
Thank You for Your Listening.