結果

問題 No.627 ランダムウォークの軌跡
ユーザー Maeda
提出日時 2025-03-25 16:23:12
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 24,832 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-25 16:23:15
合計ジャッジ時間 1,432 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d",&n);
      |     ^~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d",&positionList[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdbool.h>

void main(void){

	int n = 0;	 
    scanf("%d",&n);
    int positionList[n+1];
    positionList[0] = 0;
    for(int i = 1 ; i <= n ; i++){
        scanf("%d",&positionList[i]);
    }
    bool moveFlg = true;
    for(int i = 0 ; i < n ; i++){
        if(positionList[i+1]-positionList[i] != 1 && positionList[i+1]-positionList[i] != -1 ){
            moveFlg = false;
            break;
        }
    }
    if(moveFlg){
        printf("T");
    }else{
        printf("F");
    }
}
0