[shkola] Zadachi
- From: Ivaylo Riskov <ivaylo_riskov@xxxxxxx>
- To: shkola@xxxxxxxxxxxxx
- Date: Fri, 17 Jan 2003 18:08:43 +0200 (EET)
Taka za wsichki razbrali-nerazbrali:
shkolata shte se prowezhda wxw wtornik ot 13:30
pri obrxshtane na smenite - srqda ot 11:30(maj taka beshe)
Wseki pxt na shkolata shte dawame 4+ zadachi, koite shte razglezhdame
na sledwashtoto sxbirane i togawa shte dadem nowi zadachi i t.n.
Zadachite za sledwashtiqt pxt sa:
(btw, az sxshto ne sxm gi reshawal taka che e wxzmozhno da ima
nezabelqzani
dupki po uslowiqta - pishete wse pakako neshto ne wi e qsno)
Pozdrawi,
Ivo
**********************************************************
ZADACHA 1
**********************************************************
His name is Rampell-Stilt-Skin and another important thing is that he
is a
dead man. Someone has killed him a few days ago and you are the
detective to
solve the mystery. The problem with this guy is that he always tried
to hide
his information and feelings under the sea (I mean out of reach). He
wrote a
diary, which contained some statements and then a large binary number
(May
have as many as 10000 digits). If the number is divisible by a large
prime
number 131071 then the statement is true, otherwise the statement is
false.
In this problem you will be given large binary numbers as input and
you will
have to verify if that number is divisible by 131071 or not. Your
algorithm
needs to be very efficient.
Input
The input file contains several binary numbers. Each binary number
starts in a
new line but may expand in several lines. Each number is terminated
by a #
symbol. No line contains more than 100 digits.
Output
For every binary number print "YES" if the number is divisible by the
given
prime number, print "NO" if the binary number is not divisible by the
given
prime number.
Sample Input:
0#
1010101#
Sample Output:
YES
NO
**********************************************************
ZADACHA 2
**********************************************************
Gustavo knows how to count, but he is now learning how write numbers.
As he is
a very good student, he already learned 1, 2, 3 and 4. But he didn't
realize
yet that 4 is different than 1, so he thinks that 4 is another way to
write
1. Besides that, he is having fun with a little game he created
himself: he
make numbers (with those four digits) and sum their values. For
instance:
132 = 1 + 3 + 2 = 6
112314 = 1 + 1 + 2 + 3 + 1 + 1 = 9 (remember that Gustavo thinks that
4 = 1)
After making a lot of numbers in this way, Gustavo now wants to know
how much
numbers he can create such that their sum is a number n. For
instance, for n
= 2 he noticed that he can make 5 numbers: 11, 14, 41, 44 and 2 (he
knows how
to count them up, but he doesn't know how to write five). However, he
can't
figure it out for n greater than 2. So, he asked you to help him.
The Input
Input will consist on an arbitrary number of sets. Each set will
consist on an
integer n such that 1 <= n <= 1000. You must read until you reach the
end of
file.
The Output
For each number read, you must output another number (on a line
alone) stating
how much numbers Gustavo can make such that the sum of their digits
is equal
to the given number.
Sample Input
2
3
Sample Output
5
13
**********************************************************
ZADACHA 3
**********************************************************
Recall the definition of the Fibonacci numbers:
f1 := 1
f2 := 2
fn := fn-1 + fn-2 (n>=3)
Given two numbers a and b, calculate how many Fibonacci numbers are
in the
range [a,b].
Input Specification
The input contains several test cases. Each test case consists of two
non-negative integer numbers a and b. Input is terminated by a=b=0.
Otherwise, a<=b<=10100. The numbers a and b are given with no
superfluous
leading zeros.
Output Specification
For each test case output on a single line the number of Fibonacci
numbers fi
with a<=fi<=b.
Sample Input
10 100
1234567890 9876543210
0 0
Sample Output
5
4
**********************************************************
ZADACHA 4
**********************************************************
Let's play a number game. I will give you 2N-1(N=2^k,
k=1,2,3,4,5,6,7,8,9,10)
numbers, each number is a positive integer not bigger than 1000. Can
you
choose N of them, and add them all to a integer S, to make that S/N
is a
integer? If there are many solutions, you can only find one of them.
Input
The input file contains several scenarios. Each of them consists of
2 lines.
For each scenario, the first line is a number N, the second line
consist of
2N-1 numbers. There is a space between two numbers.
The file will be ended with N=0.
Output
For each scenario, print a single line No if you can't find an
answer.
Otherwise print a line Yes and then the other line containing N
numbers (in
any order), there should be a space between two numbers.
Sample Input
2
1 2 3
4
1 2 3 4 5 6 7
0
Sample Output
Yes
1 3
Yes
1 3 5 7
--
============================================
I used to think that the brain was the most wonderful
organ in my body. Then I realized who was telling me this.
-- Emo Phillips
============================================
__________________________________________
12MB-POP3-WAP-SMS-AHTИCПAM--TOBA-E-mail.bG
------------------------------------------
HOB БEЗПЛATEH AДPEC - http://mail.bg/new/
------------------------------------------
Other related posts: