結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2025-03-27 09:53:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 583 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 27,520 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-27 09:53:51 |
合計ジャッジ時間 | 950 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&loc); | ~~~~~^~~~~~~~~~~ main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d",&count); | ~~~~~^~~~~~~~~~~~~ main.cpp:20:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d%d",&change1,&change2); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ // カップ int cup[3] = {0,0,0}; // 〇カップの位置 int loc = 0; scanf("%d",&loc); // 〇カップの位置を配列に記憶 cup[loc - 1] = 1; // カップを入れ替える回数 int count = 0; scanf("%d",&count); // カップの入れ替え int change1,change2; for(int i = 0;i < count;i ++){ scanf("%d%d",&change1,&change2); int tmp = cup[change1 - 1]; cup[change1 - 1] = cup[change2 - 1]; cup[change2 - 1] = tmp; } // 〇カップの位置を表示 for(int i = 0;i < 3;i ++){ printf("%d",i + 1); } }