結果
問題 |
No.791 うし数列
|
ユーザー |
![]() |
提出日時 | 2021-03-08 00:05:59 |
言語 | TypeScript (5.7.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 405 bytes |
コンパイル時間 | 7,819 ms |
コンパイル使用メモリ | 228,856 KB |
実行使用メモリ | 41,456 KB |
最終ジャッジ日時 | 2024-12-31 16:32:46 |
合計ジャッジ時間 | 9,692 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 5 WA * 10 |
ソースコード
import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const array = input.split(''); const number_array = array.map(Number); let sum = 0; for (let i = 1; i < number_array.length - 1; i++) { if (number_array[i] === number_array[i + 1]) { sum = sum + 1; } } if (sum === number_array.length - 2) { console.log(number_array[2]); } else { console.log('-1'); }