Submission #3090165


Source Code Expand

Copy
'use strict'
let lines = [];
let reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function(line) {
  lines.push(line);
});

let digitSum = (n) => {
    let res = 0;
    while(n !== 0){
        res += n % 10;
        n = Math.floor(n / 10);
    }
    return res;
}
reader.on('close', function() {
    let params = lines[0].split(/\s/).map(function(n){ return parseInt(n)});
    let ans = 0;
    for(let i = 1; i <= params[0]; i++){
        let sum = digitSum(i);
        if(params[1] <= sum && sum <= params[2])
            ans += i;
    }
    console.log(ans);
});

Submission Info

Submission Time
Task ABC083B - Some Sums
User my316g
Language JavaScript (node.js v5.12)
Score 200
Code Size 660 Byte
Status
Exec Time 67 ms
Memory 8012 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 200 / 200 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 67 ms 8012 KB
02.txt 61 ms 7756 KB
03.txt 62 ms 7756 KB
04.txt 62 ms 7756 KB
05.txt 62 ms 7756 KB
06.txt 62 ms 7756 KB
07.txt 62 ms 7756 KB
08.txt 62 ms 7756 KB
s1.txt 60 ms 7500 KB
s2.txt 59 ms 7500 KB
s3.txt 60 ms 7628 KB