結果
問題 | No.223 1マス指定の魔方陣 |
ユーザー | inaenomaki |
提出日時 | 2015-06-05 23:51:38 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,504 bytes |
コンパイル時間 | 466 ms |
コンパイル使用メモリ | 58,412 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 14:24:45 |
合計ジャッジ時間 | 2,159 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | RE | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | RE | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | RE | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | RE | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:13: warning: ‘z_karima_y’ may be used uninitialized in this function [-Wmaybe-uninitialized] 13 | int z_karima_y; | ^~~~~~~~~~ main.cpp:12:13: warning: ‘z_karima_x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 12 | int z_karima_x; | ^~~~~~~~~~
ソースコード
#include<iostream> #include<vector> int main(){ int n, x, y, z; std::cin >> n >> x >> y >> z; int kari_mahoujin[4][4] = { { 0 } }; int fourmahoujin_line[4] = {0}; int z_karima_x; int z_karima_y; int now_num=1; for (int i = 0; i < 4; i++){//出来上がった4*4の魔法陣の準備 for (int j = 0; j < 4; j++){ if (i==j||(3-j)==i){ kari_mahoujin[j][i]=now_num; } else{ kari_mahoujin[j][i] = 17 - now_num; } if (kari_mahoujin[j][i] == z){ z_karima_x = j; z_karima_y = i; } // std::cout << kari_mahoujin[j][i] << " "; now_num++; } //std::cout << std::endl; } int squareline_sum = 0; int squareline_sum2 = 0; if (n == 4){ for (int i = 0; i < 4;i++){ fourmahoujin_line[i]=kari_mahoujin[i][y]; kari_mahoujin[i][y] = kari_mahoujin[i][z_karima_y]; kari_mahoujin[i][z_karima_y] = fourmahoujin_line[i]; } for (int i = 0; i < 4; i++){ fourmahoujin_line[i] = kari_mahoujin[x][i]; kari_mahoujin[x][i] = kari_mahoujin[z_karima_x][i]; kari_mahoujin[z_karima_x][i] = fourmahoujin_line[i]; } for (int i = 0; i < 4;i++){ for (int j = 0; j < 4;j++){ if (i == j){ squareline_sum += kari_mahoujin[j][i]; } if ((3 - j) == i){ squareline_sum2 += kari_mahoujin[j][i]; } } } for (int i = 0; i < 4; i++){ for (int j = 0; j < 4; j++){ std::cout << kari_mahoujin[j][i] << " "; } std::cout << std::endl; } } if (n == 8){ } if (n == 16){ } return 0; }