結果

問題 No.26 シャッフルゲーム
ユーザー Maeda
提出日時 2025-03-07 15:07:47
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 409 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 24,576 KB
実行使用メモリ 8,612 KB
最終ジャッジ日時 2025-03-07 15:07:50
合計ジャッジ時間 2,859 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:33: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Wformat=]
   10 |                 input = scanf("%d",shuffleList[0]);
      |                                ~^  ~~~~~~~~~~~~~~
      |                                 |             |
      |                                 int *         int
main.c:11:33: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Wformat=]
   11 |                 input = scanf("%d",shuffleList[1]);
      |                                ~^  ~~~~~~~~~~~~~~
      |                                 |             |
      |                                 int *         int

ソースコード

diff #

#include <stdio.h>

void main(void){
	int target = 0;
	int input = scanf("%d\n",&target);
	int shuffle = 0;
	int shuffleList[2];
	input = scanf("%d\n",&shuffle);
	for(int i = 0 ; i < shuffle ; i++){
		input = scanf("%d",shuffleList[0]);
		input = scanf("%d",shuffleList[1]);
		if(shuffleList[0] == target){
			target = shuffleList[1];
		}else if(shuffleList[1] == target){
			target = shuffleList[0];
		}
	}
}
0