SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
Basic
  郭至軒 (KuoE0)
kuoe0.tw@gmail.com
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( "%dn", 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.

Más contenido relacionado

Más de Chih-Hsuan Kuo

[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism
Chih-Hsuan Kuo
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set
Chih-Hsuan Kuo
 

Más de Chih-Hsuan Kuo (20)

[Mozilla] content-select
[Mozilla] content-select[Mozilla] content-select
[Mozilla] content-select
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in Rust
 
在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in Gecko
 
Pocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OSPocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OS
 
Necko walkthrough
Necko walkthroughNecko walkthrough
Necko walkthrough
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
 
面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!
 
應徵軟體工程師
應徵軟體工程師應徵軟體工程師
應徵軟體工程師
 
面試心得分享
面試心得分享面試心得分享
面試心得分享
 
Windows 真的不好用...
Windows 真的不好用...Windows 真的不好用...
Windows 真的不好用...
 
Python @Wheel Lab
Python @Wheel LabPython @Wheel Lab
Python @Wheel Lab
 
Introduction to VP8
Introduction to VP8Introduction to VP8
Introduction to VP8
 
Python @NCKU CSIE
Python @NCKU CSIEPython @NCKU CSIE
Python @NCKU CSIE
 
[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set
 
[ACM-ICPC] Traversal
[ACM-ICPC] Traversal[ACM-ICPC] Traversal
[ACM-ICPC] Traversal
 
[ACM-ICPC] UVa-10245
[ACM-ICPC] UVa-10245[ACM-ICPC] UVa-10245
[ACM-ICPC] UVa-10245
 
[ACM-ICPC] Sort
[ACM-ICPC] Sort[ACM-ICPC] Sort
[ACM-ICPC] Sort
 

[ACM-ICPC] 1 - Basic