結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
megane_anko
|
| 提出日時 | 2021-03-08 00:09:47 |
| 言語 | TypeScript (5.7.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 445 bytes |
| コンパイル時間 | 8,888 ms |
| コンパイル使用メモリ | 228,696 KB |
| 実行使用メモリ | 39,424 KB |
| 最終ジャッジ日時 | 2024-12-31 16:32:48 |
| 合計ジャッジ時間 | 9,706 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 9 |
ソースコード
import * as fs from 'fs';
const input = fs.readFileSync('/dev/stdin', 'utf8');
const nlarray = input.split('\n');
const array = nlarray[0].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');
}
megane_anko