题解:P12154 [蓝桥杯 2024 省 Java B] 逃离高塔

· · 题解

读题后发现当且仅当 n 的个位是 7 时,n^{3} 的个位是 3。于是题意变成找出 1 到 2025 中个位数字为 7 的数的个数。
注意到每 10 个数中就有 1 个数个位为 7,因此答案为\left \lfloor\frac{2025}{10}\right\rfloor=202 个。

AC Code

public class Main {
    public static void main(String[] args) {
        System.out.println(202);
    }
}

求过 QWQ~