結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  sasa | 
| 提出日時 | 2025-03-03 13:46:24 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 721 bytes | 
| コンパイル時間 | 304 ms | 
| コンパイル使用メモリ | 29,184 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2025-03-03 13:46:26 | 
| 合計ジャッジ時間 | 1,254 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 WA * 8 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&loc);
      |         ~~~~~^~~~~~~~~~~
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%d",&count);
      |         ~~~~~^~~~~~~~~~~~~
main.cpp:24:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |                 scanf("%d",&rep1);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp:26:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |                 scanf("%d",&rep2);
      |                 ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <stdlib.h>
int main(void){
	// カップの個数
	int judgment[3] = {0,0,0};
	int *p = judgment;
	// 〇の初期位置
	int loc = 0;
	scanf("%d",&loc);
	// 〇の位置を配列に格納
	for(int i = 0;i < 3;i++){
		if(i == (loc - 1)){
			p[i] = 1;
		}
	}
	// 入れ替える回数
	int count = 0;
	scanf("%d",&count);
	
	int i = 0;
	while(i != count){
		int rep1 = 0;
		scanf("%d",&rep1);
		int rep2 = 0;
		scanf("%d",&rep2);
		
		for(int i = 0;i < 3;i++){
			if(i == rep1){
				rep1 = p[i];
			}else if(i == rep2){
				rep2 = p[i];
			}
		}
		
		int tmp = 0;
		tmp = rep1;
		rep1 = rep2;
		rep2 = tmp;
		i++;
	}
	for(int i = 0;i < 3;i++){
		if(p[i] == 1){
			printf("%d",i + 1);
		}
	}
}
            
            
            
        