Бонус задачи и примерни тестове
Някой да знае полезни линкове за задачи по C#? И ако някой може да качи примерен изпит, за да можем да се упражняваме от по-рано.
Някой да знае полезни линкове за задачи по C#? И ако някой може да качи примерен изпит, за да можем да се упражняваме от по-рано.
Аз лично решавам задачи от телерик академията ще постна една такава тъй като са дълги и междувременно ще се опитам да намеря полезни други линкове :
People love pie. Especially Americans! They really love sweet nice just now baked pies. And you certainly love American Pie! We know you do, don’t try to argue!
Talking about pies, uncle Pi (not to be mistaken with the math Pi – 3.141592653589793) owns a bakery. He sells very delicious pies. His little dirty secret is that he actually gets the pies from outside shops. Two, if we have to be precise. Every morning uncle Pi receives two packages full of cut pie pieces. The problem is that each package’s pies are cut into different amount of pieces, giving uncle Pi two kinds of pies to sell. His solution is to divide the pieces into smaller pieces so that they have the same size. You should help uncle Pi and not by cutting his pies, but by writing a computer program to calculate how much pieces and complete pies he will have after the final cuts.
If you are not familiar with math fractions – shame on you but here it is an explanation! Fraction F/G consists of two parts – nominator (F) and denominator (G). The decimal value of every fraction is equal to the denominator dividing the nominator. For example the fraction 4/2 is equal to 2. Also on one given fraction you can multiply the nominator and the denominator by a number and the fraction’s value will not change. For example 2/5 is equal to 4/10.
You are given two fractions A/B and C/D representing parts of the two types of pies. A, B, C and D are always positive integers. You should calculate the total amount of pie you have from the two packages. In other words your task is to find the sum between the two fractions of pies. If you receive at least one complete full pie, you should calculate only the amount of full pies from the result. For example 5/2 pies are 2 pies and a half. Your final result is 2. Otherwise, if you receive less than one full pie, you should calculate the decimal result, with exactly 20 digits after the decimal point - rounded. For example 2/3 pies are equal to 0.66666666666666666667 pies as final result. In both cases you should calculate the fraction result with denominator equal to B * D. For example 2/4 + 2/3 = 14/12.
The input data should be read from the console.
On the first input line you will receive the positive integer A.
On the second input line you will receive the positive integer B.
On the third input line you will receive the positive integer C.
On the fourth input line you will receive the positive integer D.
The input data will always be valid and in the format described. There is no need to check it explicitly.
The output should be printed on the console.
If there is at least one complete pie, on the first output line you should print the amount of complete pies.
Otherwise, on the first output line you should print the decimal result with exactly 20 digits after the decimal point.
On the second output line, you should print the final fraction result with denominator equal to B * D.
Input example |
Output example |
2 4 2 3
|
1 14/12
|
1 5 2 8 |
0.45000000000000000000 18/40
|
Ще постна и една малко по - "засукана" задачка:
You are given a non-negative integer number N. Your task is to print the last 16 bits of the binary representation of N on the console. Every bit is printed in a rectangular area with 4 rows and 3 columns.
A bit with value of 1 should be printed in the format:
.#.
##.
.#.
###
A bit with value of 0 should be printed in the format:
###
#.#
#.#
###
Between every single bit there should be an empty column containing only dots (".").
The input data should be read from the console.
On the only input line there will be a non-negative integer number N which bits must be printed on the console.
The input data will always be valid and in the format described. There is no need to check it explicitly.
The output should be printed on the console.
You should print the last 16 bits of N on the console in the described format.
Your output should contain exactly 4 lines with 63 symbols on each line. Symbols should be only hashes ("#") and dots (".").
Input example |
Output example |
1
|
###.###.###.###.###.###.###.###.###.###.###.###.###.###.###..#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#..#. ###.###.###.###.###.###.###.###.###.###.###.###.###.###.###.###
|
1234
|
###.###.###.###.###..#..###.###..#...#..###..#..###.###..#..### #.#.#.#.#.#.#.#.#.#.##..#.#.#.#.##..##..#.#.##..#.#.#.#.##..#.# #.#.#.#.#.#.#.#.#.#..#..#.#.#.#..#...#..#.#..#..#.#.#.#..#..#.# ###.###.###.###.###.###.###.###.###.###.###.###.###.###.###.###
|
65535
|
.#...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#. ##..##..##..##..##..##..##..##..##..##..##..##..##..##..##..##. .#...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#. ###.###.###.###.###.###.###.###.###.###.###.###.###.###.###.### |
Ако имаш някакви затруднения и търсиш малко или много насока за решаване питай. Но се опитай като цяло за момента да се справиш сам :) Успех от мен :)
Иначе ето ти линк към bgcoder.com, където има голям брой такива задачки: bgcoder.com