Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[ACM-ICPC] 1 - Basic

1,065 views

Published on

Published in: Education
  • Be the first to comment

[ACM-ICPC] 1 - Basic

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

×