結果
問題 | No.432 占い(Easy) |
ユーザー |
|
提出日時 | 2022-11-24 06:04:02 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 153 ms / 2,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 45,348 KB |
最終ジャッジ日時 | 2024-09-25 07:04:44 |
合計ジャッジ時間 | 4,958 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
function fortuneTelling(s) { while (s.length > 1) { let x = ""; for (let i = 0; i < s.length - 1; i++) { let a = s.slice(i, i + 2); let b = (parseInt(a[0]) + parseInt(a[1])); if (b >= 10) { let c = b.toString(); x += (parseInt(c[0]) + parseInt(c[1])); } else { x += b; } } s = x } return s } function Main(input) { const src = input.split("\n"); const n = parseInt(src[0]); for (let i = 1; i <= n; i++) { console.log(fortuneTelling(src[i])); } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));