Предмет: Информатика, автор: nikitapism3245

Напишіть код Пайтон для вирішення задачі
Міс М одну з квіткових клумб зробила у вигляді шахової дошки розмірами n×m, у кожній клітинці якої росте одна квітка.

Вона збирається в гості до Сонечки та вирішила для неї зібрати букет квітів з клумби. Але оскільки Міс М дуже поспішає, то вона доручила це завдання спеціальному роботу.

Робот, починаючи завжди з верхнього лівого кута, переміщується по клумбі до правого нижнього (при цьому може ходити тільки або на одну клітинку вниз, або на одну клітинку вправо) та обов'язково збирає всі квіти на своєму шляху. При кожному проході по клумбі робот повинен зібрати як мінімум одну квітку. Після кожного такого проходу робот повертається на стартову позицію - верхній лівий кут.

Міс М не стежить наскільки оптимально робот виконує свою роботу, тому просить вас порахувати, за яку максимальну кількість проходів по клумбах робот зірве абсолютно всі квіти.

Ответы

Автор ответа: LastGhost
0

n = int(input())

m = int(input())

ans = (n - 1) * (m - 1) + 1

print(ans)

Пояснення:

Простенький код

Похожие вопросы
Предмет: Английский язык, автор: gggtygg35
WRITING Form 7
Variant 1
I. Choose and circle the correct modal verb.
1. Pupils must/mustn’t obey the teacher.
2. You have to/needn’t take off your hats when you enter your
classroom.
3. Pupils needn’t/need use the Internet at theirIT lessons.
II. Complete the sentences ( too or enough).
1. I left the coffee for a minute to cool because it was _________ hot to
drink.
2. He wasn’t strong __________ to lift that heavy box.
3. It is ___________ difficult to do for a little child.
III. Choose and circle the correct indefinite pronoun.
1. Everybody/Anybody enjoyed themselves at Kate’s party.
2. Let’s have something/everything to eat before the lesson.
3. Is nobody/anybody here?
IV. Complete the sentences ( a little or a few).
1. I’ve got __________money. Let’s have coffee.
2. She can speak__________Spanish.
3. I write _________ letters every week.
V. Write about the householding chores in your family
- the way you divide the householding chores in your family
- who does the main part of the housework
- what chores you like/don’t like doing
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________

WRITING Form 7
Variant 1І
I. Choose and circle the correct modal verb.
1. Mobile phones needn’t/must be turned off during regular school
hours.
2. Pupils have to/mustn’t use someone else’s book.
3. Students needn’t/mustn’t have dangerous objects at school.
II. Complete the sentences ( too or enough).
1. I didn’t buy the car because it was _________expensive.
2. He didn’t work hard ________to pass the exam.
3. The photograph didn’t come out because it was _________dark.
III. Choose and circle the correct indefinite pronoun.
1. Everybody/everywhere likes holidays.
2. He says he knows nothing/anything about her.
3. There is anything/something I ant to tell you.
IV. Complete the sentences ( a little or a few).
1. We had ________rain last week.
2. I’ve got ________stamps.
3. They made________ mistakes, but it was OK.
V. Write about your favourite dish
- its name
- its ingredients
- how to cook it
- when you eat it
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
СРОЧНО ДАЮ 50 БАЛОВ
Предмет: Литература, автор: maruandzunisbekov092
Предмет: Физика, автор: timaushanaorzumurado