結果
問題 | No.207 世界のなんとか |
ユーザー |
|
提出日時 | 2018-01-17 22:20:14 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 66 ms / 5,000 ms |
コード長 | 874 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 39,936 KB |
最終ジャッジ日時 | 2024-10-13 00:34:28 |
合計ジャッジ時間 | 2,254 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
/* eslint no-console: "off" */let assert = require("assert");function tokens(s) {return s.trim().split(/\s+/);}function div_ceil(a, b) {return Math.trunc(a/b) + ((((a<0)^(b>0)) && a%b) ? 1 : 0);}function div_floor(a, b) {return Math.trunc(a/b) + ((((a>0)^(b>0)) && a%b) ? 1 : 0);}function digits(n) {assert(n >= 0);if(n == 0) return [0];let res = [];while(n > 0) {res.push(n % 10);n = div_floor(n, 10);}return res;}function TO_INT(s) {return parseInt(s, 10);}function is_ok(n) {if(n % 3 == 0) return true;return digits(n).includes(3);}function Main(input) {let [A, B] = tokens(input).map(s => TO_INT(s));for(let i = A; i <= B; ++i) {if(is_ok(i)) {console.log(i);}}}Main(require("fs").readFileSync("/dev/stdin", "utf8"));