Tải bản đầy đủ (.doc) (10 trang)

Đề thi tin học trẻ ko chuyên!

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (98.94 KB, 10 trang )

Bài 1 ( 4 đ)
Mật mã Atbash ( ra
đời 500 năm TCN)
Ta có bảng chữ cái
a,b,c,d,e,f,g,h,I,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
Nguyên tắc mã hóa
: Chữ cái đầu được thay thế bởi chữ cái cuối cùng và chữ cái thứ hai
được thay thế
bởi chữ cái kế tiếp chữ cái cuối cùng và cứ như thế tiếp tục.
Yêu cầu của đề bài:
Lập chương trình mã hóa 1 chuỗi kí tự
nhâp từ bàn phím lấy trong 26 kí tự trên. Chú ý rằng chuỗi nhập không
có kí
tự trắng. nếu chuỗi nhập có kí tự không thuộc bảng trên thì yêu cầu
nhập lại
cho đến khi đạt yêu cầu
• Lập chương trình giải mã chuỗi kí tự
đã được mã hóa.
Bài 2 (3 đ)
Lập chương trình
nhập vào tọa độ 3 điểm A,B,C của tam giác ABC vào máy:
* yêu cầu trong chương trình phải có 1
đoạn kiểm tra A,B,C có thẳng hàng hay không, nếu có thì nhập lại
• Nhập vào tọa độ 1 điểm M và cho biết
M nằm trong , ngoài hay trên cạnh tam giác
Bài 3
Lập chương trình
nhập vào n số tự nhiên, tạo 1 file có tên INPUT chứa n số này, tiếp đó
lập chương
trình đọc file INPUT và tính tổng n số trong file đó. Xuất kết quả ra màn
hình



Bai giai:
Program Mat_Ma_Atbash_Decoder;
Uses CRT;
Var i:integer;
Str,Str2:String;
dk:Boolean;
Begin
Clrscr;
Repeat
Write('Nhap vao mot chuoi chu thuong(Tu a - z) va khong
co khoang cach: ');
Readln(Str);
dk:=True;
For i:=1 to length(Str) do
If not(Str[i] in ['a' 'z']) then
Begin
dk:=False;
Break;
End;
Until dk=True;
For i:=1 to length(Str) do
Str2:=Str2+chr(122-ord(Str[i])+97);
Write(Str2);
Readln;
Bài 2. Câu a dễ rùi, em chỉ làm câu b thui, cái này em khỏi xài kiến thức
đại học gì cả, mà rất đơn giản, mọi người coi sẽ biết ^^.
Code:
Uses CRT,Graph;
Var gm,gd:Integer;

Goc:Array[1 4] of PointType;
Goc_tmp:PointType;
xt,yt,seg:Word;
p1:Pointer;
Vitri:byte;
Begin
Write('Nhap X1: ');Readln(xt);
Write('Nhap Y1: ');Readln(yt);
Goc_tmp.x:=xt;
Goc_tmp.y:=yt;
Goc[1]:=Goc_tmp;
Goc[4]:=Goc_tmp;
Write('Nhap X2: ');Readln(xt);
Write('Nhap Y2: ');Readln(yt);
Goc_tmp.x:=xt;
Goc_tmp.y:=yt;
Goc[2]:=Goc_tmp;
Write('Nhap X3: ');Readln(xt);
Write('Nhap Y3: ');Readln(yt);
Goc_tmp.x:=xt;
Goc_tmp.y:=yt;
Goc[3]:=Goc_tmp;
Write('Nhap toa do X cua diem M:');Readln(xt);
Write('Nhap toa do Y cua diem M:');Readln(yt);
gm:=detect;
Initgraph(gm,gd,'');
SetbkColor(White);
Setcolor(Blue);
SetFillStyle(SolidFill,Yellow);
DrawPoly(4,Goc);

FillPoly(4,Goc);
Case GetPixel(xt,yt) of
Blue:Vitri:=1;
White:Vitri:=0;
Yellow:Vitri:=2;
End;
ClearDevice;
Case Vitri of
0:Outtextxy(1,1,'Diem M nam ngoai tam giac');
1:Outtextxy(1,1,'Diem M nam tren canh cua tam giac');
2:Outtextxy(1,1,'Diem M nam trong tam giac');
End;
Setcolor(Red);
Circle(xt,yt,1);
Circle(xt,yt,2);
Setcolor(Blue);
DrawPoly(4,Goc);
Readln;
Closegraph;
End.
Bài 3. Code hơi nhiều, nhưng rất đơn giản
Code:
Program Bai3;
Uses CRT;
Var So,i,CountSo:word;
f:file of word;
Chon:Byte;
Procedure Nhap;
Begin
Assign(f,'INPUT.DAT');

{$I-}Rewrite(f);{$I+}
If IOResult<>0 then
Begin
Writeln('Khong the tao file ''INPUT.DAT'' !!!');
Readln;
Exit;
End;
Write('Nhap vao so n phan tu: ');
Readln(CountSo);
For i:=1 to CountSo do
Begin
Write('Nhap vao so tu nhien thu ',i, ' : ');
Readln(So);
Write(f,So);
End;
Close(f);
End;
Function TinhTong:Word;
Var Tong:Word;
Begin
Tong:=0;
Assign(f,'INPUT.DAT');
{$I-}Reset(f);{$I+}
If IOResult<>0 then
Begin
Writeln('Khong the doc file ''INPUT.DAT'' !!!');
Readln;
Exit;
End;
While not(EOF(f)) do

Begin
Read(f,So);
Tong:=Tong+So;
End;
Close(f);
TinhTong:=Tong;
End;
Begin
Clrscr;
Repeat
Clrscr;

Writeln('***************************************************
***');
Writeln('1. Nhap phan tu');
Writeln('2. Tinh tong cac phan tu');
Writeln('3. Thoat');
Writeln;
Repeat
Write('Chon: ');Readln(Chon);
Until Chon in [1 3];
Case Chon of
1:Nhap;
2:Begin
Write('Tong cac phan tu la: ',TinhTong);
Readln;
End;
End
Until Chon=3;
End.

Câu1.
Nhập số nguyên N. Sau đó nhập 1 dãy gồm N phần tử .Tìm chiều dài
của dãy con có các số liên tiếp nhau mà tổng của chúng lớn nhất .
Yêu cầu:
Nhập:
N:6
123589
Xuất:
89
Câu 2.
Nhập 2 số nguyên N và M.Sau sau đó in ra ma trận gồm N cột và M
hàng.
a. Tim các số chính phương .Sau đó tìm số chính phương lớn nhất
b. Nếu N=M thì in ra trung bình cộng 2 đường chéo
c. Xuất ma trận gồm phần tử lẻ trước chẵn sau
Yêu cầu:
Nhập:
N,M:3,3
1 2 3
4 5 6
7 8 9
Xuất:
a.Cac so chinh phuong la:4,9
So chinh phuong lon nhat la:9
b.Trung binh cong cua 2 duong cheo la:15
c.
1 3 5
7 9 2
4 6 8
Câu 3.

Cho 1 chuỗi số .Hãy xoá 1 ít chữ số sao cho chữ số còn lại là 1 chữ số
giảm dần từ trái qua phải và là số lớn lớn nhất có thể có được .
Yêu cầu:
Nhập:
19235842.
Xuất:
9842
loc_math_th
09-20-2008, 09:53 PM
Bài 1: Đặt S(i)=a1 + a2 + + ai, MinS(i) là Min{S(j) với j từ 1 đến i-
1}. Tổng dãy liên tiếp lớn nhất kết thúc tại vị trí i là S(i)-MinS(i), từ đó
tìm ra lời giải.
Bài 3: Thực chất là tìm dãy con của dãy các chữ số để tạo thành số có
các chữ số giảm dần và đạt giá trị lớn nhất.
F(i) là số lớn nhất kết thúc tại i . F(i)=Max{F(j) / 1<=j<i và ai<aj}
*10 + ai
loc_math_th
09-20-2008, 09:54 PM
Bài 1:
Nhập một số nguyên dương từ bàn phím. In số vừa nhập và số được
tạo thành theo thứ tự đảo ngược ( VD số nhập là 1234 th“ số tạo
thành theo thứ tự đảo ngược là 4321 ).
Bài 2:
T“m ƯCLN của hai số nguyên không âm khác nhau.
Bài 3:
Nhập vào một dãy số nguyên
- Sắp xếp dãy số theo thứ tự tăng.
- Hãy xóa bớt các số có giá trị bằng nhau và chỉ bớt lại một số ( VD
dãy số là 1;2;2;2;3;4;5;5;7 th“ sau khi xóa la 1;2;3;4;5;7 ).
Bài 4:

T“m cách điền chín chữ số khác nhau (1;2;3;4;5;6;7;8;9) vào bảng
sau:
a b c
a' b' c'
a'' b'' c''
sao cho: a'b'c' = 2*(100a+10b+c) và đ?#8220;ng thời: a''b''c'' =
3*(100a+10b+c)
I'm a big big girl
in a big big world
It's not a big big thing if you leave me
but I do do feel that
I too too will miss you much
miss you much
I can see the first leaf falling
it's all yellow and nice
It's so very cold outside
like the way I'm feeling inside
I'm a big big girl
in a big big world
It's not a big big thing if you leave me
but I do do feel that
I too too will miss you much
miss you much
Outside it's now raining
and tears are falling from my eyes
why did it have to happen
why did it all have to end
I'm a big big girl
in a big big world
It's not a big big thing if you leave me

but I do do feel that
I too too will miss you much
miss you much
I have your arms around me ooooh like fire
but when I open my eyes
you're gone
I'm a big big girl
in a big big world
It's not a big big thing if you leave me
but I do do feel that
I too too will miss you much
miss you much
I'm a big big girl
in a big big world
It's not a big big thing if you leave me
but I do feel I will miss you much
miss you much
If only you could see the tears in the world you left behind
If only you could heal my heart just one more time
Even when I close my eyes
There's an image of your face
And once again I come I'll realise
You're a loss I can't replace
Soledad
It's a keeping for the lonely
Since the day that you were gone
Why did you leave me
Soledad
In my heart you were the only
And your memory live on

Why did you leave me
Soledad
Walking down the streets of Nothingville
Where our love was young and free
Can't believe just what an empty place
It has come to be
I would give my life away
If it could only be the same
Cause I can't still the voice inside of me
That is calling out your name
Soledad
It's a keeping for the lonely
Since the day that you were gone
Why did you leave me
Soledad
In my heart you were the only
And your memory live on
Why did you leave me
Soledad
Time will never change the things you told me
After all we're meant to be love will bring us back to you and
me
If only you could see
Soledad
It's a keeping for the lonely
Since the day that you were gone
Why did you leave me
Soledad
In my heart you were the only
And your memory live on

Why did you leave me
Soledad
Danh sách bài hát
Tên bài
Baby,baby,
I swear to you,
Baby,baby,
I\'m here for you,
I don\'t know why,
why i did those things to you,
what went through my mind,
And i don\'t know why,
why i broke your heart in two,
guess that i was blind,
Baby how i wish you could forgive me,
just one more time,baby
And i swear,
I\'ll be there,
anytime you want me to,
I\'ll be true,
here for you,
Don\'t leave me lonely,
cause i need you,
Guess i\'ve been a fool,
Now i can see the price to pay,
I can\'t run and hide,
Cause i\'m loosing you,
and my chances slipped away,
with each time i lied,
Baby how i wish you could forgive me,

One more time,
oh yeah
And i swear,(and i swear)
I\'ll be there,(i\'ll be there)
anytime you want me to,
yeah,
I\'ll be true(i\'ll be true)
here for you,
Don\'t leave me lonely,
cause i need you,
Baby,
Living without you,
will tear me apart,
When i know how it could have been,
But i don\'t care what it leads to,
let\'s make a new start,
and give love a chance to win,
cause,baby i swear,
Baby,baby,
I swear to you,
anytime you want me to,
Yes i swear,
Baby, baby,
I\'m here for you,
don\'t leave me lonely,
Cause i need you, (i need you)
And i swear,
I\'ll be there,
anytime you want me to,
yeah,

I\'ll be true,
here for you,
Don\'t leave me lonely,
Cause i need you, (cause i need you)
And i swear,(you know i\'ll be)
I\'ll be there,(i will be there)
(i swear) I\'ll be true,(i will be true)
Don\'t leave me lonely,
Cause i need you,
Yes baby i need you

×