题解 | #挑7#

挑7

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

import java.io.*; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = null; while((str = in.readLine()) != null){ long num = Long.parseLong(str); long sum = 0; long temp = 1; while(temp <= num){ long i = temp +1; if(temp % 7 == 0){ sum ++; temp = i; continue; } while(temp > 0 ){ if(temp % 10 == 7){ sum ++; break; } temp /= 10; } temp = i; } System.out.println(sum); } } }

我居南半坡 文章被收录于专栏

多刷题,积蓄力量,欢迎讨论

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务