import random
class Player(object):
def __init__(self, money):
"""Constructor"""
self.money = float(money)
def check_money_for_final(self):
if self.money >= 1000:
return False
else:
return True
def work_distribution_of_leaflets(money):
money_add = random.randint(5,10)
print("Было заработано на раздаче листовок: ", money_add, "\nВсего денег: ", money + money_add)
return money + money_add
def work_programming(money):
money_add = random.randint(5,30)
print("Было заработано на программировании: ", money_add, "\nВсего денег: ", money + money_add)
return money + money_add
def lucky_rate(money):
lucky = random.randint(0,100)
if lucky >= 50:
money_add = money * 0.5
print("Было заработано на ставке: ", money_add, "\nВсего денег: ", money + money_add)
else:
money_add = 0
money = 0
print("Всё было потеряно!\nВсего денег: ", money + money_add)
return money + money_add
if __name__ == "__main__":
player = Player(200.0)
while player.check_money_for_final():
print("Количество денег: ", player.money)
print("1) Раздавать листовки \n2) Программировать \n3) Сыграть ставку\n")
ans = input()
if ans == '1':
player.money = work_distribution_of_leaflets(player.money)
elif ans == '2':
player.money = work_programming(player.money)
elif ans == '3':
player.money = lucky_rate(player.money)
if player.money == 0.0:
print("Вы проиграли")
break
if not(player.check_money_for_final()):
print("Вы победили!")
break
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
double m, n, a, x, y;
cout << "Введите a:" << endl;
cin >> a;
cout << "Введите x:" << endl;
cin >> x;
cout << "Введите y:" << endl;
cin >> y;
m = x * y - (1 / (1.8 + sin(a * x * y)));
n = ((exp(sin(x))+pow(sin(x),1/3)/(1+log(sqrt(pow(x,2)-a)-0.82;
cout << endl << "m = " << m << endl;
cout << "n = " << n << endl;
}
uses crt;
var x:integer;
begin
read(x);
if inttostr(x)[1]>inttostr(x)[5] then
writeln(inttostr(x)[1],' ',inttostr(x)[5])
else
writeln(inttostr(x)[5],' ',inttostr(x)[1]);
end.
2.
uses crt;
var x:integer;
begin
read(x);
if (x div 10) mod 11=0 then
writeln('Yes')
else
writeln('No');
end.