結果
| 問題 | No.223 1マス指定の魔方陣 |
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2015-06-05 23:08:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,981 bytes |
| 記録 | |
| コンパイル時間 | 760 ms |
| コンパイル使用メモリ | 90,872 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 14:21:50 |
| 合計ジャッジ時間 | 2,501 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 46 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:80:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
80 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:99:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
99 | scanf("%d%d%d", &a, &b, &c);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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;
}
Kmcode1