#14098: 都轉成一維來思考也是不錯的選擇!!


Richard19990502 (richard880502)

學校 : 元智大學
編號 : 76647
來源 : [114.25.213.233]
最後登入時間 :
2022-03-21 23:03:28
b367. 翻轉世界 -- 自己 | From: [210.66.144.8] | 發表日期 : 2018-06-12 22:39

#include <iostream>
using namespace std;

int main()
{
int amount, row, column, size, *ary;
bool check;
while (cin >> amount)
{
for (int k = 0; k < amount; k++)
{
cin >> column >> row;

size = column * row;
check = true;
ary = new int[size]();

for (int i = 0; i < size; i++)
cin >> ary[i];
for (int i = 0;i < size/2;i++)
if (ary[i] != ary[size - 1 - i])
{
check = false;
break;
}
delete[]ary;
if (check == true)
cout << "go forward\n";
else
cout << "keep defending\n";
}
}
}

 
ZeroJudge Forum