結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-11-23 19:18:46 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 344 bytes | 
| コンパイル時間 | 171 ms | 
| コンパイル使用メモリ | 20,992 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-13 17:17:17 | 
| 合計ジャッジ時間 | 661 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%d%d", &n, &m);
      |   ^~~~~~~~~~~~~~~~~~~~~
main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%d%d", &p, &q);
      |     ^~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main(){
  int cup[3]={0};
  int n, m, p, q;
  int tmp;
  int i;
  scanf("%d%d", &n, &m);
  cup[n-1]=1;
  for(i=0; i<m; ++i){
    scanf("%d%d", &p, &q);
    tmp=cup[p-1];
    cup[p-1]=cup[q-1];
    cup[q-1]=tmp;
  }
  for(i=0; i<3; ++i){
    if(cup[i]==1){
      printf("%d\n", i+1);
      break;
    }
  }
  return 0;
}
            
            
            
        