結果

問題 No.223 1マス指定の魔方陣
ユーザー Kmcode1Kmcode1
提出日時 2015-06-05 23:08:03
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,981 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 90,244 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-20 19:25:31
合計ジャッジ時間 2,872 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;
int R[22][22];
int RR[22][22];
int n;
int dx[] = { 1, -1 };
int dy[] = { -1, 1 };
int a, b, c;
void sw(){
	for (int i = 0; i < 2; i++){
		for (int j = 0; j < 2; j++){
			int be = (dx[i] == 1) ? 0:n - 1;
			int be2 = (dy[j] == 1) ? 0 : n - 1;
			int xx = 0;
			int yy = 0;
			bool ok = false;
			for (int k = be; k < n&&k>=0; k+=dx[j]){
				xx++;
				for (int kk = be2; kk < n&&kk >= 0; kk += dy[j]){
					yy++;
					if (xx == a&&yy == b){
						if (R[xx][yy] == c){
							ok = true;
						}
					}
				}
			}
			if (ok == false){
				
			}
			else{
				be = (dx[i] == 1) ? 0 : n - 1;
				be2 = (dy[j] == 1) ? 0 : n - 1;
				xx = 0;
				yy = 0;
				//bool ok = false;
				for (int k = be; k < n&&k >= 0; k += dx[j]){
					xx++;
					for (int kk = be2; kk < n&&kk >= 0; kk += dy[j]){
						yy++;
						if (kk == be2){
							printf(" ");
						}
						else{
							printf("%d", R[k][kk]);
						}
					}
					puts("");
				}
				exit(0);
			}
		}
	}
}
int main(){
	scanf("%d", &n);
	for (int y = 0; y < n; y++){
		for (int x = 0; x < n; x++) {
			int tx = x % 4, ty = y % 4;
			int kari = 0;

			if (tx == 0 && ty == 1) kari++;
			if (tx == 0 && ty == 2) kari++;
			if (tx == 3 && ty == 1) kari++;
			if (tx == 3 && ty == 2) kari++;
			if (tx == 1 && ty == 0) kari++;
			if (tx == 2 && ty == 0) kari++;
			if (tx == 1 && ty == 3) kari++;
			if (tx == 2 && ty == 3) kari++;
			if (kari == 0) R[y][x] = y*n + x + 1;
			else R[y][x] = n*n + 1 - (y*n + x + 1);
		}
	}
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	exit(1);
	return 0;
}
0