Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // OK https://informatics.msk.ru/moodle/mod/statements/view3.php?chapterid=113440#1
- # include <iostream>
- size_t a_n(size_t n) {
- return n / 2;
- }
- size_t b_n(size_t n) {
- return (n + 1) / 2;
- }
- size_t c_n(size_t n) {
- if (n != 0) {
- return (n - 1) / 2;
- }
- return 0;
- }
- int main() {
- size_t n, a, b, c;
- std::cin >> n >> a >> b >> c;
- while (b-- > 0) {
- n = b_n(n);
- }
- while (a-- > 0) {
- n = a_n(n);
- }
- while (c-- > 0) {
- n = c_n(n);
- }
- std::cout << n;
- return 0;
- }
Add Comment
Please, Sign In to add comment