結果

問題 No.627 ランダムウォークの軌跡
ユーザー SKanaya
提出日時 2018-03-28 21:51:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 23,808 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 13:18:30
合計ジャッジ時間 1,061 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%d",&T);
      |   ~~~~~^~~~~~~~~
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d",&X);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
int main() {
  int T, x=0, X, ret=1;
  scanf("%d",&T);
  for(int i=0;i<T;i++) {
    scanf("%d",&X);
    if( abs(x-X)==1 )  x = X;
    else ret=0;
  }
  printf("%c\n",ret?'T':'F');
  return 0;
}
0