题解 | #最长无重复子数组#

挑7

http://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(sc.hasNextInt()) {
            int n = sc.nextInt();
            int count=0;
            for(int i=7;i<=n;i++) {
                if(i%7==0 || String.valueOf(i).contains("7"))
                    count++;
            }
            System.out.println(count);
        }
        sc.close();
    }
}

全部评论

相关推荐

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

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务