Daily AtCoder # 1 in Python

Introduction

From this time, I'm planning to solve the problem of competitive professionals (AtCoder) with python3 every day. The problem selection is from Recommendations in AtCoder Problems (https://kenkoooo.com/atcoder/#/list/tax_free).

Purpose

--Increase the rate. ――Getting the ability to respond to first-time problems

#1 Problem

** Thoughts ** 2WA. I found that I was not good at the problem of thinking about case classification. This issue was categorized by the size of n mod (10). If you read the question, you will be asked how much it will cost to buy N or more, so you will know that you can buy more than N. The following is a comparison of whether it is cheaper to buy individually or collectively with n mod (10).

n mod(10),Individual,Individualとまとめて買ったときの差
1 , 15 , 85
2 , 30 , 70
3 , 45 , 55
4 , 60 , 40
5 , 75 , 25
6 , 90 , 10
7 , 105 , -5
8 , 120 , -20
9 , 135 , -35
10 , 150 , -50

It will be. From this, you can see that it is cheaper to buy in bulk when n mod (10)> 6. Therefore,

if n % 10 > 6:
    b = 100 * (n // 10 + 1)
else:
    p = n % 10
    b = 100 * (n // 10) + p * 15

If you set it to, you can meet the conditions well. All you have to do is add standard inputs and outputs to the code above. Use min () for output.

n = int(input())
a = 15 * n
if n % 10 > 6:
    b = 100 * (n // 10 + 1)
else:
    p = n % 10
    b = 100 * (n // 10) + p * 15
print(min(a,b))

Summary

It is regrettable that 2WA was issued even though it was a problem. There is a disturbing word in the tag, but I will do my best not to do so.

Recommended Posts

Daily AtCoder # 36 in Python
Daily AtCoder # 2 in Python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Daily AtCoder # 53 in Python
Daily AtCoder # 33 in Python
Daily AtCoder # 7 in Python
Daily AtCoder # 24 in Python
Daily AtCoder # 37 in Python
Daily AtCoder # 8 in Python
Daily AtCoder # 42 in Python
Daily AtCoder # 17 in Python
Daily AtCoder # 54 in Python
Daily AtCoder # 11 in Python
Daily AtCoder # 47 in Python
Daily AtCoder # 13 in Python
Daily AtCoder # 45 in Python
Daily AtCoder # 30 in Python
Daily AtCoder # 40 in Python
Daily AtCoder # 10 in Python
Daily AtCoder # 5 in Python
Daily AtCoder # 28 in Python
Daily AtCoder # 39 in Python
Daily AtCoder # 19 in Python
Daily AtCoder # 52 in Python
Daily AtCoder # 3 in Python
Daily AtCoder # 14 in Python
Daily AtCoder # 50 in Python
Daily AtCoder # 26 in Python
Daily AtCoder # 4 in Python
Daily AtCoder # 43 in Python
Daily AtCoder # 29 in Python
Daily AtCoder # 22 in Python
Daily AtCoder # 49 in Python
Daily AtCoder # 27 in Python
Daily AtCoder # 1 in Python
Daily AtCoder # 25 in Python
Daily AtCoder # 16 in Python
Daily AtCoder # 12 in Python
Daily AtCoder # 48 in Python
Daily AtCoder # 23 in Python
Daily AtCoder # 34 in Python
Daily AtCoder # 51 in Python
Daily AtCoder # 31 in Python
Daily AtCoder # 46 in Python
Daily AtCoder # 35 in Python
Daily AtCoder # 9 in Python
Daily AtCoder # 44 in Python
Daily AtCoder # 41 in Python
Atcoder ABC164 A-C in Python
atCoder 173 Python
Python Input Note in AtCoder
Atcoder ABC167 A-D in Python
Atcoder ABC165 A-D in Python
Atcoder ABC166 A-E in Python
Atcoder ABC169 A-E in Python
AtCoder ABC177 A-D in python
Solve Atcoder ABC169 A-D in Python
[Python] Basic knowledge used in AtCoder
Quadtree in Python --2