MINCOINSREQ - EDITORIAL

PROBLEM LINK:

Contest
Practice

Setter: abhi_inav
Testers: inov_360, mexomerf
Editorialist: hrishik85

DIFFICULTY:

390

PREREQUISITES:

None

PROBLEM:

There are 2 denominations of coins in Chefland

  • Coin worth Rs 1 each
  • Notes worth Rs 10 each

Chef wants to pay his friend X rupees. What is the minimum number of coins Chef needs to pay.

EXPLANATION:

Chef will have to pay the minimum coins when the value paid via notes is maximised.
Hence, the number of coins he can pay with are X mod 10 - i.e. the amount remaining when maximum possible possible amount is paid in Rs 10 notes.

TIME COMPLEXITY:

Time complexity is O(1).

SOLUTION:

Editorialist's Solution
t=int(input())
for _ in range(t):
    N = int(input())
    print(N%10)