You are on page 1of 23

CPE

2011 12 04
CPE CPE

CPE ................................................................. 1
CPE ............................................................................................................ 1
CPE ........................................................................................................ 2
................................................................................................ 3

........................................................................ 4
Code::Blocks .................................................................................................. 5
Code::Blocks ...................................................................................... 9

.............................................................. 10
...................................................................................................................... 10
n ..................................................................................................... 12
...................................................................................................... 15
0 .......................................................................................................... 17

...................................................................... 19
...................................................................................... 19
...................................................................................... 20
CPE
CPE
CPE CentOS Linux

CPE

1
CPE
Firefox

CPE

CPE

CPE
http://acm-icpc.tw/exam/

CPE
http://conf.acm-icpc.tw/CPE_user_manual/CPE_user_manual.html

CPE

documentation

C++ reference STL JDK

3

CPE

Code::Blocks
Eclipse
Emacs
gedit
Vim

Code::Blocks
Eclipse

gedit Vim
Emacs

Code::Blocks ( Dev-C++)

Code::Blocks

4
Code::Blocks

Code::Blocks

1. New File Empty file

5
2.

C .cC++.cpp

Code::Blocks

3.

1.

2.

3.

4.

Ctrl+F9
Ctrl+F10
F9

Code::Blocks

Settings > Editor...


Font Choose

TAB options Indent options

8
Code::Blocks

Code::Blocks (

) Code::Blocks

Windows

Code::Blocks
http://www.codeblocks.org/downloads

Download the binary release MinGW

Ubuntu

sudo apt-get update


sudo apt-get install codeblocks -y

C language

C scanf printf

scanf

int scanf(const char *format, ...);

char * %c char * %s

(unsigned) char * %hhd %hhu %hho %hhx
(unsigned) short * %hd %hu %ho %hx
(unsigned) int * %d %u %o %x
(unsigned) long * %ld %lu %lo %lx
(unsigned) long long * %lld %llu %llo %llx
float * %f double * %lf

&

&

10

char ch,str[64];
int num;
float value;

scanf("%c%s%d%f",&ch,str,&num,&value);

%c spacetab

enter

scanf("%d%f%f%f", ...) )

3 3.1.10.2.20.3.30 3 3..1.10
1.10 1.10.2.20.3.30
2.20 .2.20...3.30
3.30

C++

C++ cin coutcin

>>

11
n
n n

C language

int main() {
int n;
scanf("%d",&n);
while (n--) {
/* */
}
return 0;
}

C++

int main() {
int n;
cin>>n;
while (n--) {
//
}
return 0;
}

12

10406: Vito's family


Vito

C Language

#include <stdio.h>
#define MAX_R 100

int num[MAX_R];

int main() {
int n,r,s,i;
int sum;

scanf("%d",&n);
while (n--) {
scanf("%d",&r);
for (i=0;i<r;i++) {
scanf("%d",&s);
num[i]=s;
}

/* */

printf("%d\n",sum);
}

return 0;
}

13
C++

#include <iostream>
#include <vector>
using namespace std;

vector<int> num;

int main() {
int n,r,s;

cin>>n;
while (n--) {
cin>>r;
num.clear();
for (int i=0;i<r;i++) {
cin>>s;
num.push_back(s);
}

//

cout<<endl;
}

return 0;
}

10401: Fibonaccimal Base

10403: Funny Encryption Method

10408: What is the Probability?

14

C language

scanf scanf

scanf EOF

while

int main() {
int x;
while (scanf("%d",&x)!=EOF) {
/* */
}
return 0;
}

C++

cin while cin void*

NULL 0 false

int main() {
int x;
while (cin>>x) {
//
}
return 0;
}

15

10407: Hashmat the brave warrior


C Language

#include <stdio.h>

int main() {
long long a,b; /* 2^32 unsigned int */
while (scanf("%lld%lld",&a,&b)!=EOF) {
/* */
}
return 0;
}

scanf ong long %lld

C++

#include <iostream>
using namespace std;

int main() {
long long a,b; // 2^32 unsigned int
while (cin>>a>>b) {
//
}
return 0;
}

10400: The 3n + 1 problem

10405: Jolly Jumpers ()

10411: Back to High School Physics

16
0

C language

int main() {
int n;
while (scanf("%d",&n)!=EOF) {
if (n==0) break;

/* ... */
}
return 0;
}

C++

int main() {
int n;
while (cin>>n) {
if (n==0) break;

// ...
}
return 0;
}

10404: Primary Arithmetic


17
C Language

#include <stdio.h>

int main() {
int a,b;
while (scanf("%d%d",&a,&b)!=EOF) {
if (a==0&&b==0) break;

/* */
}
return 0;
}

C++

#include <iostream>
using namespace std;

int main() {
int a,b;
while (cin>>a>>b) {
if (a==0&&b==0) break;

/* */
}
return 0;
}

10416: Last Digit

10418: Minesweeper

18

( enter)

19

(

.in)

(Terminal)

20
( cd ls

<

./ <

()

21

You might also like