0%

CodeForces 977A v2

CodeForces 977A v2 - Wrong Subtraction

Wrong Subtraction

題意:

他給你一個N然後可以有K次操作。
操作條件:
● if the last digit of the number is non-zero, she decreases the number by one.(如果他不為0則減一)

● if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).(如果他為0就除以10)

思路:

每次將N模10看看於數是不是0如果不是就減1,其餘除10。

程式碼: