結果

問題 No.26 シャッフルゲーム
ユーザー ちよちゃんちよちゃん
提出日時 2016-06-04 13:29:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 1,334 bytes
コンパイル時間 3,711 ms
コンパイル使用メモリ 74,928 KB
実行使用メモリ 42,020 KB
最終ジャッジ日時 2024-04-17 00:17:05
合計ジャッジ時間 6,076 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
41,436 KB
testcase_01 AC 140 ms
41,380 KB
testcase_02 AC 186 ms
41,836 KB
testcase_03 AC 151 ms
41,504 KB
testcase_04 AC 154 ms
41,648 KB
testcase_05 AC 162 ms
41,852 KB
testcase_06 AC 162 ms
41,776 KB
testcase_07 AC 154 ms
41,536 KB
testcase_08 AC 160 ms
42,020 KB
testcase_09 AC 182 ms
41,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Yuki26 {
    
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
    	// cup
    	int[] a = new int[3];
    	
    	a[sc.nextInt()-1] = 1;
    	//入れ替える回数
    	int m = sc.nextInt();
    	
    	for (int i=0; i<m; i++) {
    		int b = sc.nextInt()-1;
    		int c = sc.nextInt()-1;
    		int d = a[b];
            
    		a[b] = a[c];
    		a[c] = d;	
    	}
    	
    	sc.close();
    	
    	for (int i =0; i<3; i++) {
    		if(a[i] == 1){
    			System.out.println(i+1);
    		}
    	}
    	
        	/*
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int changeCount = scan.nextInt();

        int changeCupArray[][] = new int [changeCount][2];
        
        for (int i = 0; i < changeCount;i++) {
            for(int j = 0; j < 2; j++) {
                changeCupArray[i][j] = scan.nextInt();
            }
        }
        scan.close();		
        
        int pastValue = num;
        for (int i = 0; i < changeCount;i++) {
            for(int j = 0; j < 2; j++) {
                if(changeCupArray[i][j] == pastValue ){
                    pastValue = changeCupArray[i][j];
                }
            }
        }
        System.out.println(pastValue);
        */
    }
}
0