結果
| 問題 | No.791 うし数列 |
| コンテスト | |
| ユーザー |
megane_anko
|
| 提出日時 | 2021-03-08 00:09:47 |
| 言語 | TypeScript (6.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 445 bytes |
| 記録 | |
| コンパイル時間 | 5,098 ms |
| コンパイル使用メモリ | 349,040 KB |
| 実行使用メモリ | 53,240 KB |
| 最終ジャッジ日時 | 2026-06-05 05:28:20 |
| 合計ジャッジ時間 | 7,267 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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