您的答案為: Test #6: Symmetric. 正確答案為: Test #6: Non-symmetric.
通過檢測
我在uva過了但這裡只有五十%
程式碼如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
for(int r=1;r<=t;r++)
{
int t2;
//char c;
cin.ignore(10,' ');
cin.ignore(10,' ');
cin>>t2;
//cout<<t2<<"t";
//cout<<t2<<"\n";
long long int n[t2][t2];
for(int i=0;i<t2;i++)
{
for(int j=0;j<t2;j++) cin>>n[i][j];
}
bool f=1;
for(int i=0;i<t2;i++)
{
for(int j=0;j<t2;j++)
{
if(n[i][j]!=n[t2-1-i][t2-1-j]||n[i][j]<0) {f=0;break;
}
//cout<<n[i][j]<<" "<<n[t2-1-i][t2-j-1]<<"\n";
}
}
cout<<"Test #"<<r<<": ";
if(f) cout<<"Symmetric.\n";
else cout<<"Non-symmetric.\n";
}
}
您的答案為: Test #6: Symmetric. 正確答案為: Test #6: Non-symmetric.
通過檢測
我在uva過了但這裡只有五十%
程式碼如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
for(int r=1;r<=t;r++)
{
int t2;
//char c;
cin.ignore(10,' ');
cin.ignore(10,' ');
cin>>t2;
//cout<<t2<<"t";
//cout<<t2<<"\n";
long long int n[t2][t2];
for(int i=0;i<t2;i++)
{
for(int j=0;j<t2;j++) cin>>n[i][j];
}
bool f=1;
for(int i=0;i<t2;i++)
{
for(int j=0;j<t2;j++)
{
if(n[i][j]!=n[t2-1-i][t2-1-j]||n[i][j]<0) {f=0;break;
}
//cout<<n[i][j]<<" "<<n[t2-1-i][t2-j-1]<<"\n";
}
}
cout<<"Test #"<<r<<": ";
if(f) cout<<"Symmetric.\n";
else cout<<"Non-symmetric.\n";
}
}
以更正,因為測資中有殘留空白,被這行cin.ignore(10,' ');讀到導致錯誤。
您的答案為: Test #6: Symmetric. 正確答案為: Test #6: Non-symmetric.
通過檢測
我在uva過了但這裡只有五十%
程式碼如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
for(int r=1;r<=t;r++)
{
int t2;
//char c;
cin.ignore(10,' ');
cin.ignore(10,' ');
cin>>t2;
//cout<<t2<<"t";
//cout<<t2<<"\n";
long long int n[t2][t2];
for(int i=0;i<t2;i++)
{
for(int j=0;j<t2;j++) cin>>n[i][j];
}
bool f=1;
for(int i=0;i<t2;i++)
{
for(int j=0;j<t2;j++)
{
if(n[i][j]!=n[t2-1-i][t2-1-j]||n[i][j]<0) {f=0;break;
}
//cout<<n[i][j]<<" "<<n[t2-1-i][t2-j-1]<<"\n";
}
}
cout<<"Test #"<<r<<": ";
if(f) cout<<"Symmetric.\n";
else cout<<"Non-symmetric.\n";
}
}
以更正,因為測資中有殘留空白,被這行cin.ignore(10,' ');讀到導致錯誤。
Thanks