Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
7Activity
0 of .
Results for:
No results containing your search query
P. 1
BaitapLTNC

BaitapLTNC

Ratings: (0)|Views: 2,200|Likes:
Published by api-3844544

More info:

Published by: api-3844544 on Oct 18, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

TR\u01af\u1edcNG C\u0110DL C\u00d4NG NGH\u1ec6 TH\u00d4NG TIN
KHOA C\u00d4NG NGH\u1ec6 TH\u00d4NG TIN
B\u00c0I T\u1eacP K\u1ef8 THU\u1eacT L\u1eacP TR\u00ccNH N\u00c2NG CAO
I. B\u00e0i t\u1eadp c\u01a1 b\u1ea3n

1. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadp v\u00e0o m\u1ed9t s\u1ed1 nguy\u00ean d\u01b0\u01a1ng n. ki\u1ec3m tra n l\u00e0 s\u1ed1 nguy\u00ean t\u1ed1 hay
kh\u00f4ng?
2. Li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 s\u1ed1 nguy\u00ean t\u1ed1 nh\u1ecf h\u01a1n n. V\u1edbi n >= 2 nh\u1eadp t\u1eeb b\u00e0n ph\u00edm.

3. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadp v\u00e0o s\u1ed1 nguy\u00ean d\u01b0\u01a1ng n>=2. H\u00e3y ph\u00e2n t\u00edch n th\u00e0nh t\u00edch c\u00e1c
th\u1eeba s\u1ed1 nguy\u00ean t\u1ed1.
V\u00ed d\u1ee5 : nh\u1eadp n = 45. Ph\u00e2n t\u00edch 45 = 3* 3*5.
4. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh chuy\u1ec3n \u0111\u1ed5i m\u1ed9t s\u1ed1 nguy\u00ean d\u01b0\u01a1ng n nh\u1eadp t\u1eeb b\u00e0n ph\u00edm sang s\u1ed1 nh\u1ecb
ph\u00e2n.
5. T\u00ecm \u01b0\u1edbc chung l\u1edbn nh\u1ea5t v\u00e0 b\u1ed9i chung nh\u1ecf nh\u1ea5t c\u1ee7a 2 s\u1ed1 nguy\u00ean d\u01b0\u01a1ng n v\u00e0 m nh\u1eadp t\u1eeb
b\u00e0n ph\u00edm. (S\u1eed d\u1ee5ng tu\u1eadt to\u00e1n Euclide : USCLN(A,B) = USCLN(B, A mod B) v\u1edbi A>B )
6. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadp v\u00e0o s\u1ed1 nguy\u00ean d\u01b0\u01a1ng n. T\u00ednh v\u00e0 in ra t\u1ed5ng:
S = 22 - 42 + 62 - 82+\u2026\u2026+(-1)n-1(2n)2.
7. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadp v\u00e0o s\u1ed1 nguy\u00ean d\u01b0\u01a1ng N. T\u00ednh v\u00e0 in ra t\u1ed5ng:
(a)
N
S
1
......
4
1
3
1
2
1
1
+
+
+
+
+
=
(b)
!
1
......
!
41
!
31
!
21
!
11
1
N
S
+
+
+
+
+
+
=
8. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh t\u00ednh ex theo c\u00f4ng th\u1ee9c x\u1ea5p x\u1ec9 :
!
......
!
4
!
3
!
2
!
1
1
4
3
2
1
N
x
x
x
x
x
e
N
x
+
+
+
+
+
+
=
V\u1edbi n nh\u1eadp t\u1eeb b\u00e0n ph\u00edm.
9. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh t\u00ednh ex theo c\u00f4ng th\u1ee9c x\u1ea5p x\u1ec9 :
......
!
......
!
4
!
3
!
2
!
1
1
4
3
2
1
+
+
+
+
+
+
+
=
N
x
x
x
x
x
e
N
x
V\u1edbi \u0111\u1ed9 ch\u00ednh x\u00e1c\u03b5 (r\u1ea5t nh\u1ecf) nh\u1eadp t\u1eeb b\u00e0n ph\u00edm\u03b5 = xn/n!.
10. D\u00e3y Fibonacci {Fn} \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a: F1=F2= 1 , Fn = Fn-1 + Fn-2 ( v\u1edbi n>=3).

Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh:
- Nh\u1eadp s\u1ed1 nguy\u00ean n, t\u00ednh v\u00e0 in ra ph\u1ea7n t\u1eed Fn
- Nh\u1eadp s\u1ed1 nguy\u00ean d\u01b0\u01a1ng m v\u00e0 in ra d\u00e3y Fibonacci m ph\u1ea7n t\u1eed.

Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadp m\u1ed9t s\u1ed1 nguy\u00ean t\u1ed1i \u0111a c\u00f3 4 ch\u1eef s\u1ed1. In s\u1ed1 \u0111\u1ea3o ng\u01b0\u1ee3c c\u1ee7a n\u00f3.
V\u00ed d\u1ee5: nh\u1eadp 357, in ra 753.
1/6
11. C\u00e0i \u0111\u1eb7t ch\u01b0\u01a1ng tr\u00ecnh \u201cTh\u00e1p H\u00e0 N\u1ed9i\u201d.
12**. C\u00e0i \u0111\u1eb7t m\u00f4 ph\u1ecfng ch\u01b0\u01a1ng tr\u00ecnh \u201cTh\u00e1p H\u00e0 N\u1ed9i\u201d.
II. Chu\u1ed7i
1. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh con tr\u1ea3 v\u1ec1 m\u1ed9t chu\u1ed7i l\u00e0 \u0111\u1ea3o ng\u01b0\u1ee3c c\u1ee7a m\u1ed9t chu\u1ed7i.
H\u01b0\u1edbng d\u1eabn: H\u00e0m char * DaoChuoi(char *S) tr\u1ea3 v\u1ec1 k\u1ebft qu\u1ea3 l\u00e0 \u0111\u1ea3o c\u1ee7a chu\u1ed7i S.
2. Vi\u1ebft h\u00e0m ki\u1ec3m tra m\u1ed9t chu\u1ed7i c\u00f3 \u0111\u1ed1i x\u1ee9ng hay kh\u00f4ng.
V\u00ed d\u1ee5: Chu\u1ed7i MADAM l\u00e0 \u0111\u1ed1i x\u1ee9ng.
3. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh t\u00e1ch ph\u1ea7n t\u00ean trong m\u1ed9t chu\u1ed7i ch\u1ee9a h\u1ecd v\u00e0 t\u00ean Vi\u1ec7t Nam.
V\u00ed d\u1ee5: chu\u1ed7i Nguyen Van Ba th\u00ec ph\u1ea7n t\u00ean l\u00e0Ba
4. Vi\u1ebft h\u00e0m strdel(char *S, int Posi, int Num) d\u00f9ng \u0111\u1ec3 xo\u00e1 chu\u1ed7i S m\u1ed9t s\u1ed1 k\u00fd t\u1ef1 l\u00e0
Num b\u1eaft \u0111\u1ea7u t\u1eeb v\u1ecb tr\u00ed th\u1ee9i Posi.
5. Vi\u1ebft h\u00e0m strinsert(char *INS, char *S, int Posi) d\u00f9ng \u0111\u1ec3 ch\u00e8n chu\u1ed7i INS v\u00e0o
chu\u1ed7i S t\u1eeb v\u1ecb tr\u00ed Posi.
6. Vi\u1ebft h\u00e0m ki\u1ec3m tra xem m\u1ed9t chu\u1ed7i c\u00f3 tu\u1ea7n ho\u00e0n hay kh\u00f4ng?
V\u00ed d\u1ee5: Chu\u1ed7i S = \u201cABCABCABC\u201d l\u00e0 chu\u1ed7i tu\u1ea7n ho\u00e0n
7. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh nh\u1eadp v\u00e0o 2 chu\u1ed7i S1 v\u00e0 S2. In ra c\u00e1c v\u1ecb tr\u00ed xu\u1ea5t hi\u1ec7n c\u1ee7a chu\u1ed7i
S1 trong S2.
8. Vi\u1ebft ch\u01b0\u01a1ng tr\u00ecnh \u0111\u1ea3o ng\u01b0\u1ee3c v\u1ecb tr\u00ed c\u00e1c t\u1eeb trong c\u00e2u.
V\u00ed d\u1ee5: \u201cKIEN AN CA\u201d \u0111\u1ed5i th\u00e0nh \u201cCA AN KIEN\u201d

9. Nh\u1eadp v\u00e0o m\u1ed9t c\u00e2u ch\u1ec9 bao g\u1ed3m c\u00e1c k\u00fd t\u1ef1 s\u1ed1 (kh\u00f4ng c\u00f3 k\u00fd t\u1ef1 kho\u1ea3ng tr\u1eafng), n\u1ebfu nh\u1eadp sai ph\u1ea3i y\u00eau c\u1ea7u nh\u1eadp l\u1ea1i cho h\u1ee3p l\u1ec7. \u0110\u1ecbnh ngh\u0129a m\u1ed9t t\u1eeb l\u00e0 c\u00e1c k\u00fd s\u1ed1 li\u00ean ti\u1ebfp kh\u00f4ng l\u1eabn k\u00fd t\u1ef1 kh\u00f4ng (\u20180\u2019). H\u00e3y cho bi\u1ebft:

a) Trong c\u00e2u c\u00f3 bao nhi\u00eau t\u1eeb.
b) M\u1ed9t t\u1eeb t\u01b0\u01a1ng \u0111\u01b0\u01a1ng v\u1edbi m\u1ed9t s\u1ed1 nguy\u00ean. H\u00e3y \u0111\u1ed5i c\u00e1c t\u1eeb th\u00e0nh gi\u00e1 tr\u1ecb v\u00e0
cho bi\u1ebft g\u00eda tr\u1ecb l\u1edbn nh\u1ea5t.

V\u00ed d\u1ee5:C\u00e2u nh\u1eadp S=\u201d720045600021000068000123\u201d
C\u00e2u c\u00f3 5 t\u1eeb.
C\u00e1c gi\u00e1 tr\u1ecb \u0111\u1ed5i th\u00e0nh l\u00e0: 72; 456; 21; 68; 123; S\u1ed1 456 l\u00e0 l\u1edbn nh\u1ea5t.

III. X\u1eed l\u00fd m\u1ea3ng
1. \u0110\u1ecbnh ngh\u0129a ki\u1ec3u d\u1eef li\u1ec7u m\u1ea3ng m\u1ed9t chi\u1ec1u c\u00e1c s\u1ed1 nguy\u00ean c\u00f3 t\u1ed1i \u0111a 100 ph\u1ea7n t\u1eed. Sau \u0111\u00f3

c\u00e0i \u0111\u1eb7t c\u00e1c h\u00e0m th\u1ef1c hi\u1ec7n c\u00e1c ch\u1ee9c n\u0103ng sau:
a) Nh\u1eadp m\u1ea3ng.
b) In m\u1ea3ng ra m\u00e0n h\u00ecnh.
c) S\u1eafp x\u1ebfp m\u1ea3ng theo th\u1ee9 t\u1ef1 t\u0103ng d\u1ea7n.
d) T\u00ednh t\u1ed5ng c\u00e1c ph\u1ea7n t\u1eed trong m\u1ea3ng.

2/6

e) In ra c\u00e1c s\u1ed1 nguy\u00ean t\u1ed1 trong m\u1ea3ng.
f) T\u00ednh t\u1ed5ng c\u00e1c s\u1ed1 nguy\u00ean t\u1ed1 trong m\u1ea3ng.
g) T\u00ecm ph\u1ea7n t\u1eed x c\u00f3 trong m\u1ea3ng hay kh\u00f4ng?
h) T\u00ecm ph\u1ea7n t\u1eed l\u1edbn nh\u1ea5t c\u1ee7a m\u1ea3ng.

i) In ra ph\u1ea7n t\u1eed nh\u1ecf nh\u1ea5t v\u00e0 v\u1ecb tr\u00ed c\u1ee7a ph\u1ea7n t\u1eed \u0111\u00f3 (n\u1ebfu c\u00f3 nhi\u1ec1u ph\u1ea7n t\u1eed nh\u1ecf nh\u1ea5t

th\u00ec ch\u1ec9 in v\u1ecb tr\u00ed \u0111\u1ea7u ti\u00ean).
j) \u0110\u1ebfm s\u1ed1 ph\u1ea7n t\u1eed l\u00e0 b\u1ed9i s\u1ed1 c\u1ee7a 3 c\u1ee7a d\u00e3y
k) Th\u00eam v\u00e0o d\u00e3y ph\u1ea7n t\u1eed x t\u1ea1i v\u1ecb tr\u00ed k (k<n)
l) X\u00f3a ph\u1ea7n t\u1eed t\u1ea1i v\u1ecb tr\u00ed k (k<n)
m) T\u00ecm c\u1eb7p ph\u1ea7n t\u1eed c\u00f3 t\u1ed5ng b\u00ecnh ph\u01b0\u01a1ng \u0111\u00fang b\u1eb1ng k.

2. Nh\u1eadp v\u00e0o m\u1ed9t d\u00e3y s\u1ed1 nguy\u00ean k\u1ebft th\u00fac b\u1eb1ng vi\u1ec7c nh\u1eadp s\u1ed1 0 (s\u1ed1 0 kh\u00f4ng \u0111\u01b0a v\u00e0o d\u00e3y)
ho\u1eb7c khi \u0111\u00e3 nh\u1eadp \u0111\u1ee7 20 s\u1ed1. Ki\u1ec3m tra c\u00f3 hay kh\u00f4ng c\u00e1c t\u00ednh ch\u1ea5t sau \u0111\u00e2y c\u1ee7a d\u00e3y:
a) D\u00e3y \u0111\u01a1n nh\u1ea5t? (Kh\u00f4ng c\u00f3 ph\u1ea7n t\u1eed tr\u00f9ng nhau trong d\u00e3y)
b) D\u00e3y \u0111an d\u1ea5u? (2 ph\u1ea7n t\u1eed k\u1ec1 nhau ph\u1ea3i kh\u00e1c \u0111\u1ea5u, d\u00e3y 1 ph\u1ea7n t\u1eed xem nh\u01b0 \u0111an
d\u1ea5u)

c) D\u00e3y tu\u1ea7n ho\u00e0n? ( D\u00e3y tu\u1ea7n ho\u00e0n : N\u1ebfu Ai , Ai+1 , Ai+2 l\u00e0 3 ph\u1ea7n t\u1eed li\u00ean ti\u1ebfp trong d\u00e3y th\u00ec: Ai+1\u2265 Ai v\u00e0 Ai+1\u2265 Ai+2 ho\u1eb7c Ai+1\u2264 Ai v\u00e0 Ai+1\u2264 Ai+2. D\u00e3y c\u00f3 2 ph\u1ea7n t\u1eed tr\u1edf xu\u1ed1ng xem nh\u01b0 tu\u1ea7n ho\u00e0n )

d) D\u00e3y t\u0103ng d\u1ea7n?
e) D\u00e3y gi\u1ea3m d\u1ea7n?
3. Nh\u1eadp d\u00e3y s\u1ed1 nguy\u00ean A c\u00f3 na ph\u1ea7n t\u1eed (0< na <=20). T\u00e1ch A th\u00e0nh 2 d\u00e3y: d\u00e3y B ch\u1ee9a
c\u00e1c s\u1ed1 l\u1ebb, d\u00e3y C ch\u1ee9a c\u00e1c s\u1ed1 ch\u1eb5n. Xu\u1ea5t c\u00e1c d\u00e3y l\u00ean m\u00e0n h\u00ecnh .

4. Nh\u1eadp d\u00e3y s\u1ed1 nguy\u00ean A c\u00f3 n ph\u1ea7n t\u1eed (0< n <=20). C\u00e0i \u0111\u1eb7t c\u00e1c ch\u01b0\u01a1ng tr\u00ecnh con \u0111\u1ec3 th\u1ef1c
hi\u1ec7n c\u00e1c c\u00f4ng vi\u1ec7c:
a) S\u1eafp c\u00e1c ph\u1ea7n t\u1eed v\u1ecb tr\u00ed l\u1ebb t\u0103ng d\u1ea7n, c\u00e1c ph\u1ea7n t\u1eed v\u1ecb tr\u00ed ch\u1eb5n gi\u1ea3m d\u1ea7n
b) S\u1eafp c\u00e1c ph\u1ea7n t\u1eed d\u01b0\u01a1ng v\u1ec1 \u0111\u1ea7u d\u00e3y c\u00f3 th\u1ee9 t\u1ef1 gi\u1ea3m d\u1ea7n, c\u00e1c ph\u1ea7n t\u1eed \u00e2m cu\u1ed1i d\u00e3y c\u00f3 th\u1ee9
t\u1ef1 t\u0103ng d\u1ea7n.
c) S\u1eafp c\u00e1c s\u1ed1 nguy\u00ean t\u1ed1 v\u1ec1 \u0111\u1ea7u d\u00e3y c\u00f3 th\u1ee9 t\u1ef1 t\u0103ng d\u1ea7n, c\u00e1c ph\u1ea7n t\u1eed c\u00f2n l\u1ea1i c\u00f3 th\u1ee9 t\u1ef1 gi\u1ea3m
d\u1ea7n.

5. Nh\u1eadp 2 d\u00e3y s\u1ed1 nguy\u00ean b t\u0103ng d\u1ea7n v\u00e0 c gi\u1ea3m d\u1ea7n. Tr\u1ed9n 2 d\u00e3y b, c th\u00e0nh d\u00e3y a t\u0103ng d\u1ea7n
(Kh\u00f4ng cho ph\u00e9p s\u1eafp x\u1ebfp tr\u00ean d\u00e3y a)

6. Cho ma tr\u1eadn s\u1ed1 nguy\u00ean c\u1ea5p n x m. C\u00e0i \u0111\u1eb7t c\u00e1c h\u00e0m th\u1ef1c hi\u1ec7n c\u00e1c thao t\u00e1c tr\u00ean ma tr\u1eadn:
a) Nh\u1eadp ma tr\u1eadn
b) In ma tr\u1eadn
c) T\u00ecm ph\u1ea7n t\u1eed nh\u1ecf nh\u1ea5t
d) T\u00ecm ph\u1ea7n t\u1eed l\u1edbn nh\u1ea5t (ch\u1ec9 ra v\u1ecb tr\u00ed )

e) T\u00ecm d\u00f2ng c\u00f3 t\u1ed5ng l\u1edbn nh\u1ea5t, n\u1ebfu nhi\u1ec1u d\u00f2ng c\u00f3 t\u1ed5ng b\u1eb1ng nhau th\u00ec cho bi\u1ebft d\u00f2ng
\u0111\u1ea7u ti\u00ean)
f) T\u00ecm c\u1ed9t c\u00f3 t\u1ed5ng nh\u1ecf nh\u1ea5t, in ra t\u1ed5ng v\u00e0 v\u1ecb tr\u00ed t\u00ecm th\u1ea5y c\u1ee7a n\u00f3 (ch\u1ec9 s\u1ed1 c\u1ed9t), n\u1ebfu nhi\u1ec1u
d\u00f2ng c\u00f3 t\u1ed5ng b\u1eb1ng nhau th\u00ec cho bi\u1ebft d\u00f2ng \u0111\u1ea7u ti\u00ean)
3/6

Activity (7)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Huấn Cao liked this
mtstudio liked this
nguyentruong3168 liked this
bangguoi liked this
trungnghia12c liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->