結果
問題 |
No.627 ランダムウォークの軌跡
|
ユーザー |
![]() |
提出日時 | 2021-02-17 23:29:39 |
言語 | TypeScript (5.7.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 8,848 ms |
コンパイル使用メモリ | 228,216 KB |
実行使用メモリ | 41,064 KB |
最終ジャッジ日時 | 2024-12-31 16:27:15 |
合計ジャッジ時間 | 10,912 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 WA * 1 |
ソースコード
import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const arr1 = input.split('\n');//['3', '1', '2', '1'] let n = parseInt(arr1[0]); let result = 0; let rarr = []; let answer = 0; for (let i = 1; i < n; i++) {//条件式はあってる result = parseInt(arr1[i + 1]) - parseInt(arr1[i]) rarr.push(result);//差の配列に格納 } //console.log(rarr);//差の配列はとれてる for (let j = 0; j < n; j++) { if (Math.abs(rarr[j]) === 1) { answer = answer + 1; } } if (parseInt(arr1[1]) === 0) { console.log("F"); } else if (answer === (n - 1)) { console.log("T"); } else { console.log("F"); }