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