結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  TLwiegehtt | 
| 提出日時 | 2015-07-07 02:12:20 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 368 bytes | 
| コンパイル時間 | 212 ms | 
| コンパイル使用メモリ | 20,608 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 01:25:53 | 
| 合計ジャッジ時間 | 773 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         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);
      |                 ^~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main(void){
	int i;
	int N,M;
	int ans[4];
	for(i=0;i<4;i++){ans[i] = 0;}
	scanf("%d", &N);
	ans[N] = 1;
	scanf("%d", &M);
	
	for(i=0;i<M;i++){
		int P,Q;
		int temp;
		scanf("%d %d", &P, &Q);
		
		temp = ans[P];
		ans[P] = ans[Q];
		ans[Q] = temp;
	}
	
	for(i=1;i<=3;i++){
		if(ans[i] == 1){
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}
            
            
            
        