結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  latte0119 | 
| 提出日時 | 2015-05-02 15:56:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 274 bytes | 
| コンパイル時間 | 1,100 ms | 
| コンパイル使用メモリ | 157,912 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-05 17:29:00 | 
| 合計ジャッジ時間 | 1,730 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   15 |     printf("%d\n",find(cup,cup+3,1)-cup+1);
      |             ~^    ~~~~~~~~~~~~~~~~~~~~~~~
      |              |                         |
      |              int                       long int
      |             %ld
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
    int cup[3]={0};
    int N,M;
    cin>>N>>M;
    cup[--N]=1;
    while(M--){
        int a,b;
        cin>>a>>b;
        swap(cup[--a],cup[--b]);
    }
    printf("%d\n",find(cup,cup+3,1)-cup+1);
    return 0;
}
            
            
            
        