結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  hape8810 | 
| 提出日時 | 2019-01-31 12:36:55 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 289 bytes | 
| コンパイル時間 | 117 ms | 
| コンパイル使用メモリ | 22,144 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-08 19:48:16 | 
| 合計ジャッジ時間 | 759 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&M);
      |     ~~~~~^~~~~~~~~
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d %d",&p,&q);
      |         ~~~~~^~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main(void){
    int N,M,p,q,i;
    scanf("%d",&N);
    scanf("%d",&M);
    for(i=0;i<M;i++){
        scanf("%d %d",&p,&q);
        if(p==N){
            N=q;
        }
        else if(q==N){
            N=p;
        }
    }
    printf("%d\n",N);
    
    return 0;
}
            
            
            
        