Модель пам'яті C++11 та механізми її підтримки, Part 2
3 квітня 2014, 16:30
Аудиторія 1-331
Презентація
Форма оцінювання доповіді
Доповідатиме аспірант Володимир Лашко
Аудиторія 1-331
Презентація
Форма оцінювання доповіді
Доповідатиме аспірант Володимир Лашко
- +1
- 01 квітня 2014, 10:30
- GarfieldUA
- 1
Light and Transparencies
Задача на реалізацію. Прекрасна. Хто зробить кращу реалізацію, поговорю з адміном за НАГОРОДУ =-)
Light and Transparencies
When light traverses a transparent film, some energy is absorbed and the rest is transmitted to other side of the film. The percentage of light that is transmitted may be defined as Transparency Coefficient.
When several films are in the same direction of light, the correspondent transparency coefficients are multiplied. The goal of this problem is to determine the percentage of light that is projected on the ground, after traversing a given set of films.

Consider the set of lines segments in fig. 1. They represent transparent films in the above conditions (transparency coefficients are written in brackets). Also consider that light is propagating in the vertical direction, from top to bottom.
Accordingly to the figure, the end points of the lines define a set of projected segments onto the ground (ground is represented by the X axe). For each projected segment, it is possible to evaluate the percentage of light that reaches the ground and, for the entire set of segments, a list can be obtained:
-inf, 2.0 -> 1.000
2.0, 4.0 -> 0.900
4.0, 7.0 -> 0.630
7.0, 9.0 -> 0.504
9.0, 13.5 -> 0.560
13.0, 17.0 -> 0.800
17.0, +inf -> 1.000
To simplify the problem, it is assumed that neither vertical lines nor crossing lines are given. Also no coincidences exist in the vertical projection of all given points (in other words, the X coordinates of the end points are all different from each other). On the other hand, a coordinate may be any real value from — $ \infty$ to + $ \infty$.
Input
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
The input is a text file containing several lines, as follows.
The first line of the input contains the number NL (integer format) of line segments. It is followed by NL lines of text defining, each one, a line segment.
Accordingly to the above explanations, a line segment is defined by the coordinates of its two end points P1 and P2 and the transparency coefficient r, in the sequence x1 y1 x2 y2 r, separated by single spaces (all the five values are in the real format). No order is considered for the two points P1 and P2.
Output
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
The first line of the output contains the number NP (integer format) of projected segments. It is followed by NP lines of text, defining, each one, a projected segment. These lines must be sorted in ascending order of X values.
A projected segment must be defined by its coordinates X1 and X2, followed by the evaluated percentage of light. All the tree values must be in real format, rounded to 3 decimal digits and separated by single spaces. Infinite values must be represented by `-inf' or `+inf'.
Sample Input
1
3
2.0 2.0 9.0 2.0 0.9
13.5 2.0 4.0 8.5 0.7
17.0 10.0 7.0 8.5 0.8
Sample Output
7
-inf 2.000 1.000
2.000 4.000 0.900
4.000 7.000 0.630
7.000 9.000 0.504
9.000 13.500 0.560
13.500 17.000 0.800
17.000 +inf 1.000
— Тестуйте ось тут, нажимайте кнопочку «Submit»:
оригінал
Light and Transparencies
When light traverses a transparent film, some energy is absorbed and the rest is transmitted to other side of the film. The percentage of light that is transmitted may be defined as Transparency Coefficient.
When several films are in the same direction of light, the correspondent transparency coefficients are multiplied. The goal of this problem is to determine the percentage of light that is projected on the ground, after traversing a given set of films.

Consider the set of lines segments in fig. 1. They represent transparent films in the above conditions (transparency coefficients are written in brackets). Also consider that light is propagating in the vertical direction, from top to bottom.
Accordingly to the figure, the end points of the lines define a set of projected segments onto the ground (ground is represented by the X axe). For each projected segment, it is possible to evaluate the percentage of light that reaches the ground and, for the entire set of segments, a list can be obtained:
-inf, 2.0 -> 1.000
2.0, 4.0 -> 0.900
4.0, 7.0 -> 0.630
7.0, 9.0 -> 0.504
9.0, 13.5 -> 0.560
13.0, 17.0 -> 0.800
17.0, +inf -> 1.000
To simplify the problem, it is assumed that neither vertical lines nor crossing lines are given. Also no coincidences exist in the vertical projection of all given points (in other words, the X coordinates of the end points are all different from each other). On the other hand, a coordinate may be any real value from — $ \infty$ to + $ \infty$.
Input
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
The input is a text file containing several lines, as follows.
The first line of the input contains the number NL (integer format) of line segments. It is followed by NL lines of text defining, each one, a line segment.
Accordingly to the above explanations, a line segment is defined by the coordinates of its two end points P1 and P2 and the transparency coefficient r, in the sequence x1 y1 x2 y2 r, separated by single spaces (all the five values are in the real format). No order is considered for the two points P1 and P2.
Output
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
The first line of the output contains the number NP (integer format) of projected segments. It is followed by NP lines of text, defining, each one, a projected segment. These lines must be sorted in ascending order of X values.
A projected segment must be defined by its coordinates X1 and X2, followed by the evaluated percentage of light. All the tree values must be in real format, rounded to 3 decimal digits and separated by single spaces. Infinite values must be represented by `-inf' or `+inf'.
Sample Input
1
3
2.0 2.0 9.0 2.0 0.9
13.5 2.0 4.0 8.5 0.7
17.0 10.0 7.0 8.5 0.8
Sample Output
7
-inf 2.000 1.000
2.000 4.000 0.900
4.000 7.000 0.630
7.000 9.000 0.504
9.000 13.500 0.560
13.500 17.000 0.800
17.000 +inf 1.000
— Тестуйте ось тут, нажимайте кнопочку «Submit»:
оригінал
- 0
- 27 березня 2014, 11:52
- kutsyk
- Залишити коментар
Improve your skills
Всім привіт, напишу маленький quide з власного досвіду, як та звідкіля вивчати алгоритми.Всі великі брендові Facebook компанії вимагають від вас логіки, вони хочуть ПРОГРАМІСТІВ, а не кодерів. Мабуть вже не раз чули «Різниця між програмістом та кодеров в тому, що перший створює, а другий кодить.» Програміст шукає розвязок, а кодер друкує. Тож якщо Ви не розглядаєте себе в майбутньому як крутого чувачка який розробляє власні проекти та шукає рішеня в складних задачах. Тоді цей пост не для вас.
Читати далі
Читати далі
- +1
- 24 березня 2014, 16:32
- kutsyk
- Залишити коментар
У цей четвер на гуртку - Пошук
Тема завтрашньої доповіді:
Пошук
Питання, що будуть розглянуті:
Презентація та додаткові матеріали
13 березня 2014, 16:30
Аудиторія 1-331
Доповідатиме Василь Куцик
Пошук
Питання, що будуть розглянуті:
- Алгоритм Карпа Рабіна
- Алгоритм Бойєра — Мура
- Алгоритм Кнута Моріса Пратта
Презентація та додаткові матеріали
13 березня 2014, 16:30
Аудиторія 1-331
Доповідатиме Василь Куцик
- 0
- 12 березня 2014, 09:43
- GarfieldUA
- Залишити коментар
Робіть висновки
In ICPCs, coding should not be your bottleneck at all. That is, once you figure out the ‘worst
AC algorithm’ that will pass the given time limit, you are supposed to be able to translate it into
bug-free code and you can do it fast! Try to do some exercises below. If you need more than
10 lines of code to solve them, you will need to relearn your programming language(s) in depth!
Mastery of programming language routines will help you a lot in programming contests.
1. Given a string that represents a base X number, e.g. FF (base 16, Hexadecimal), convert it
to base Y, e.g. 255 (base 10, Decimal), 2 ≤ X, Y ≤ 36. (More details in Section 5.4.2).
2. Given a list of integers L of size up to 1M items, determine whether a value v exists in L?
(More details in Section 2.2.1).
3. Given a date, determine what is the day (Monday, Tuesday, ..., Sunday) of that date?
4. Given a long string, replace all the occurrences of a character followed by two consecutive
digits in with “***”, e.g. S = “a70 and z72 will be replaced, but aa24 and a872 will not” will
be transformed to S = “*** and *** will be replaced, but aa24 and a872 will not”.
AC algorithm’ that will pass the given time limit, you are supposed to be able to translate it into
bug-free code and you can do it fast! Try to do some exercises below. If you need more than
10 lines of code to solve them, you will need to relearn your programming language(s) in depth!
Mastery of programming language routines will help you a lot in programming contests.
1. Given a string that represents a base X number, e.g. FF (base 16, Hexadecimal), convert it
to base Y, e.g. 255 (base 10, Decimal), 2 ≤ X, Y ≤ 36. (More details in Section 5.4.2).
2. Given a list of integers L of size up to 1M items, determine whether a value v exists in L?
(More details in Section 2.2.1).
3. Given a date, determine what is the day (Monday, Tuesday, ..., Sunday) of that date?
4. Given a long string, replace all the occurrences of a character followed by two consecutive
digits in with “***”, e.g. S = “a70 and z72 will be replaced, but aa24 and a872 will not” will
be transformed to S = “*** and *** will be replaced, but aa24 and a872 will not”.
Повинен вміти кожен
Всім привіт, вчимось і вчимось, а чи вміємо ми вводити такі штучки:
1 10
100 200
201 210
900 1000
Поясню, що я маю на увазі: потрібно ввести всі ці числа, тобто по два числа, к-сть рядків не визначена і може бути різною…
Відповідь кодом в коментарі=-)
1 10
100 200
201 210
900 1000
Поясню, що я маю на увазі: потрібно ввести всі ці числа, тобто по два числа, к-сть рядків не визначена і може бути різною…
Відповідь кодом в коментарі=-)
Модель пам'яті C++11 та механізми її підтримки
Тема завтрашньої доповіді:
Модель пам'яті C++11 та механізми її підтримки
Питання, що будуть розглянуті:
27 лютого 2014, 16:30
Аудиторія 1-331
Презентація
Доповідатиме аспірант Володимир Лашко
Модель пам'яті C++11 та механізми її підтримки
Питання, що будуть розглянуті:
- Механізм оптимізації програм, гонка потоків та модель пам'яті
- «Семантика» коректної програми — acquire та release
- «Синтаксис» коректної програми — м'ютекси, атомарні операції та бар'єри
- Деякі обмеження компіляторів та процесорів
- Швидкодія паралельних програм: x86/x64, IA64, POWER, ARM
27 лютого 2014, 16:30
Аудиторія 1-331
Презентація
Доповідатиме аспірант Володимир Лашко
- 0
- 26 лютого 2014, 21:01
- GarfieldUA
- 2
Потрібний курс
Прекрасний курс, потрібний всім, незалежно чи ви програміст чи бізнесмен, як застосовувати ігрові елементи в не ігрових проектах.
https://class.coursera.org/gamification-003
https://class.coursera.org/gamification-003
- 0
- 16 лютого 2014, 22:06
- kutsyk
- Залишити коментар
Гурток з програмування: доповідь про біоінформатику
Завтра нарешті відбудеться доповідь стосовно біоінформатики. Детальніше: oop.in.ua/blog/143.html
- 0
- 12 лютого 2014, 23:09
- john_paul
- Залишити коментар
Дуже сподобалась задача.
Хто зробить задачу той молодець:
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of «and» when writing out numbers is in compliance with British usage.
Хто не знає є такий крутий сервіс: projecteuler
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of «and» when writing out numbers is in compliance with British usage.
Хто не знає є такий крутий сервіс: projecteuler
- 0
- 12 лютого 2014, 18:49
- kutsyk
- Залишити коментар
Must read books, my advise
Вирішив додати книжечку в Must Read:
Читається легко, щось схоже на Effective C++, але вже більш філософського маштабу:
This book
Читається легко, щось схоже на Effective C++, але вже більш філософського маштабу:
This book
- 0
- 05 лютого 2014, 21:37
- kutsyk
- Залишити коментар
Біоінформатика
ВІДРЕДАГОВАНО: ЗАВТРА 23 СІЧНЯ ГУРТОК ВІДМІНЯЄТЬСЯ!
ПАМ'ЯТКА
Зважаючи на різке погіршення криміногенної ситуації у Києві, закликаємо Вас:
1. Не ходити поодинці у темний час доби.
2. Завжди мати при собі посвідчення особи.
3. Бажано про пересування містом попередньо інформувати довірену особу.
4. Завжди мати при собі написаний телефон довіреної особи, якій можна буде зателефонувати в разі потреби.
5. Бажано взагалі утримуватися від вживання алкоголю.
6. Ближнім часом у гуртожитках НаУКМА в темний час доби буде організоване спеціальне чергування.
У разі необхідності юридичної підтримки – телефони гарячої лінії 0685481241; 0666849830; 0633379573.
Ректорат Національного університету «Києво-Могилянська академія»
Презентація про біоінформатику як новий та перспективний міждисциплінарий напрям.
Короткий вступ до основних понять.
Чому це може бути цікавим для інформатика?
Чому варто цим займатися?
Презентація
23 січня 2014, 16:20
Аудиторія 1-331
Доповідає Євгенія Ошурко та Богдан Кулинич
ПАМ'ЯТКА
Зважаючи на різке погіршення криміногенної ситуації у Києві, закликаємо Вас:
1. Не ходити поодинці у темний час доби.
2. Завжди мати при собі посвідчення особи.
3. Бажано про пересування містом попередньо інформувати довірену особу.
4. Завжди мати при собі написаний телефон довіреної особи, якій можна буде зателефонувати в разі потреби.
5. Бажано взагалі утримуватися від вживання алкоголю.
6. Ближнім часом у гуртожитках НаУКМА в темний час доби буде організоване спеціальне чергування.
У разі необхідності юридичної підтримки – телефони гарячої лінії 0685481241; 0666849830; 0633379573.
Ректорат Національного університету «Києво-Могилянська академія»
- 0
- 22 січня 2014, 17:00
- john_paul
- Залишити коментар
Гурток продовжує свою роботу!
Радий повідомити, що груток з програмування продовжує свою роботу після канікул!
Вже у цей четвер (16 січня), о 16:30 у 1-331 випускниця магістерської програми ІУСТ, нині — аспірантка НаУКМА Анна Дьоміна розповідатиме про сучасні тенденції в проектуванні інформаційних систем та напрямок свого майбутнього дослідження, виходячи з власного 4-річного досвіду роботи програмістом.
Презентація
16 січня 2014, 16:30
Аудиторія 1-331
Вже у цей четвер (16 січня), о 16:30 у 1-331 випускниця магістерської програми ІУСТ, нині — аспірантка НаУКМА Анна Дьоміна розповідатиме про сучасні тенденції в проектуванні інформаційних систем та напрямок свого майбутнього дослідження, виходячи з власного 4-річного досвіду роботи програмістом.
Презентація
16 січня 2014, 16:30
Аудиторія 1-331
- 0
- 14 січня 2014, 09:52
- GarfieldUA
- Залишити коментар
Баян, або код, який виводить сам себе на екран (quine)
Про баянізм красномовно свідчить назва, але на випадок, якщо раптом хто не в курсі: написати код, який… виводить сам себе на екран!
Хто лінивий, про це є навіть окрема стаття на вікіпедії (див quine). Хто наполегливий, той молодець.
Хто лінивий, про це є навіть окрема стаття на вікіпедії (див quine). Хто наполегливий, той молодець.
За якою книгою Ви б хотіли проводити заняття з курсу "Науковий семінар" (2013-2014 н.р.)?
Проголосувало: 14 | Утрималося: 2
- 0
- 25 листопада 2013, 18:00
- GarfieldUA
- 1