Выделите победителя игры(того кто первый наберёт ) Потом спросите хочет ли игрок начать игру заново. Если ответ будет "да" начните заново
(❗python❗)
Ответы на вопрос:
from os import system
from random import randint
answ = 'да'
answers = ['камень', 'ножницы', 'бумага']
while answ == 'да':
system("cls")
bot_balls = 0
person_balls = 0
while bot_balls < 3 and person_balls < 3:
person = str(input("\nВаш вариант: "))
bot = answers[randint(0, 2)]
print("Я выбрал:", bot)
if person == bot:
print("Ничья")
elif (person == answers[0] and bot == answers[1]) or (person == answers[1] and bot == answers[2]) or (person == answers[2] and bot == answers[1]):
print("Вы победили!")
person_balls += 1
elif (person == answers[0] and bot == answers[2]) or (person == answers[1] and bot == answers[0]) or (person == answers[2] and bot == answers[1]):
print("Вы проиграли!")
bot_balls += 1
print("Счет:", person_balls, ":", bot_balls)
answ = str(input("\nХотите продолжить?: "))
system("cls")
print(" за игру!")
if person_balls > bot_balls:
print("Вы победили со счетом:", person_balls, ":", bot_balls)
else:
print("Вы проигради со счетом:", person_balls, ":", bot_balls)
bool ok1(int a, int b, int c){
return (a+b > c && a+c > b && b+c > a) && min(a,min(b,c)) > 0;
}
bool ok2(int a, int b, int c){
return ok1(a,b,c) && (a == b || a == c || b == c);
}
signed main(){
const int n = 3, m = 7;
int arr[n][m];
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
cin >> arr[i][j];
vector<int> ans;
for(int j = 0; j < m; j++)
if(ok2(arr[0][j],arr[1][j],arr[2][j]))
ans.push_back(j+1);
cout << ans.size() << "\n";
for(auto i: ans)
cout << i << " ";
}
Подробнее - на -
Объяснение:
Популярно: Информатика
-
бегуния16.09.2020 20:32
-
аянаайши05.03.2022 01:22
-
teaego01.11.2022 20:57
-
Garri120930.01.2021 08:10
-
azodanic1223.12.2022 23:26
-
дана40323.06.2021 16:04
-
arlashmanov17.11.2022 13:05
-
zadorina6627.07.2020 04:13
-
Remrans22.06.2023 08:33
-
Mpazd25.09.2022 06:42