結果

問題 No.1168 Digit Sum Sequence
コンテスト
ユーザー Masaki Kitaguchi
提出日時 2026-01-12 02:29:00
言語 JavaScript
(node v25.2.1)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 353 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 219 ms
コンパイル使用メモリ 7,976 KB
実行使用メモリ 52,436 KB
最終ジャッジ日時 2026-01-12 02:29:05
合計ジャッジ時間 5,156 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

function main(input) {
  const N = parseInt(input.trim());
  const a_1 = N;
  let a_i = a_1;
  for (let i = 2; i <= 100; i++) {
  	a_i = String(a_i).split("").map(Number).reduce((sum, num) => sum + num, 0);
  }
  const a_100 = a_i;
  return String(a_100);
}

// Don't edit this line!
console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));
0