結果

問題 No.351 市松スライドパズル
ユーザー akakimidoriakakimidori
提出日時 2017-01-18 01:54:24
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 21,520 KB
実行使用メモリ 6,320 KB
最終ジャッジ日時 2023-10-25 07:51:22
合計ジャッジ時間 2,981 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
6,320 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 0 ms
4,348 KB
testcase_13 AC 134 ms
6,208 KB
testcase_14 AC 135 ms
6,240 KB
testcase_15 AC 137 ms
6,320 KB
testcase_16 AC 137 ms
6,320 KB
testcase_17 AC 132 ms
6,320 KB
testcase_18 AC 132 ms
6,320 KB
testcase_19 AC 134 ms
6,320 KB
testcase_20 AC 137 ms
6,320 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%d%d",&h,&w);
      |   ^~~~~~~~~~~~~~~~~~~
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%d",&n);
      |   ^~~~~~~~~~~~~~
main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%s%d",s+i,k+i);
      |     ^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

void run(void){
  int h,w;
  scanf("%d%d",&h,&w);
  int n;
  scanf("%d",&n);
  char *s=(char *)malloc(sizeof(char)*(n+1));
  int *k=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++){
    scanf("%s%d",s+i,k+i);
  }
  int x=0;
  int y=0;
  for(i=n-1;i>=0;i--){
    if(s[i]=='R'){
      if(k[i]==y){
        x=(x-1>=0?x-1:x-1+w);
      }
    } else {
      if(k[i]==x){
        y=(y-1>=0?y-1:y-1+h);
      }
    }
  }
  if((x+y)%2==0){
    printf("white\n");
  } else {
    printf("black\n");
  }
  return;
}

int main(void){
  run();
  return 0;
}
0