CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Solve this challenge in a different way or in a different programming language.
Write in the comments.
------------------------------------
ENGLISH LANGUAGE:
This program is my solution to a fairly well-known challenge: Filu's parents promised to give Snickers every 29 days. But if he gets Snickers 2 times in one month, then their contract is terminated. Phil should choose the day of January, in which he will begin to receive Snickers. Write a program that will help Phil select the day of January and get the maximum number of Snickers
For example: Phil chose January 1, and he will receive the next Snickers on January 30, that is, the agreement is terminated.
-------------------------------------
РУССКИЙ ЯЗЫК:
Эта программа-моё решение одной довольно известной олимпиадной задачи:
Филу родители обещали дарить Snickers каждые 29 дней. Но если он получит Snickers 2 раза за один месяц, то их договор расторгается. Филу нужно выбрать день января, в который он начнёт получать Snickers. Напишите программу, которая поможет Филу выбрать день января и получить максимальное количество Snickers'ов.
Например: Фил выбрал 1 января, и следующий Snickers он получит 30 января,то есть соглашение расторгается.
*/
#include <iostream>
using namespace std;
int main()
{
int day;
int snickers=1;
int propysk;
cout<<"Write here the January number you want Snickers to get:";
cin>>day;
while (day>0){
cout<<snickers<<endl;
day+=29;
switch (snickers) {
case 1:
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run