1到10的5次方里就4个完数,直接打表输出就行。

Problem A

https://www.nowcoder.com/practice/ee083fda4b39446d9aa543b1039475b8

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums = {6, 28, 496, 8128};
        while (sc.hasNextInt()) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            for (int num : nums) {
                if (num >= a && num <= b) {
                    System.out.println(num);
                }
            }
        }
    }
}

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务