题解 | #挑7#
挑7
http://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b
while(line = readline()) {
const num = parseInt(line);
let count = 0;
for (let i = 1; i <= num; i++) {
if (isCludesSeven(i.toString()) || isSevenX(i)) {
count++;
}
}
print(count);
}
function isCludesSeven(str) {
return /[7]/.test(str);
}
function isSevenX(num) {
return num % 7 == 0;
}