結果

問題 No.26 シャッフルゲーム
ユーザー mosmos_21mosmos_21
提出日時 2016-02-14 16:37:43
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 310 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 20,860 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 05:15:09
合計ジャッジ時間 795 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 0 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 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d", &N);
      |         ^~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d", &M);
      |         ^~~~~~~~~~~~~~~
main.c:15:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%d %d", &P, &Q);
      |                 ^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){

	int N, M, P, Q;
	int cup[4] = {0};
	int i, j;

	scanf("%d", &N);
	scanf("%d", &M);

	cup[N] = 1;

	for(i = 0; i < M; i++){
		scanf("%d %d", &P, &Q);
		j = cup[P];
		cup[P] = cup[Q];
		cup[Q] = j;
	}

	for(i = 0; i < 4; i++)
		if(cup[i] == 1)
			printf("%d\n", i);
	return 0;
}
0