2012/02/22

[zerojudge] d060 還要等多久啊?

題目:https://zerojudge.tw/ShowProblem?problemid=d060
說明:跟 d050 類似的題目,減掉輸入時間後有機會後是負數,再多加上 60 並取餘數。

Java 版
import java.util.Scanner;

public class D060 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int a = Integer.parseInt(in.nextLine());
            int m = (25 - a + 60) % 60;
            System.out.println(m);
        }
    }
}
Python 版 (2022.07)
while True:
    try:
        m = int(input())
        print((25 - m + 60) % 60)
    except:
        break

沒有留言:

張貼留言