/***
Md. Nazmul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<cstring>
#include<sstream>
#include<cmath>
#include <iomanip>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
int test,dimen,cs=1;
long long matrix[105][105];
bool symetry;
void is_symetry()
{
if(!symetry)
return;
for(int i=0 ; i<dimen ; i++)
{
for(int j=0 ; j<dimen ; j++)
{
if(matrix[i][j] != matrix[dimen-1-i][dimen-1-j])
{
symetry = false;
return ;
}
}
}
}
int main()
{
char str[1001];
sc("%d",&test);
while(test--)
{
getchar();
gets(str);
symetry = true ;
sscanf(str,"%c = %d",&str[0],&dimen);
for(int i=0 ; i<dimen ; i++)
{
for(int j=0 ; j<dimen ; j++)
{
sc("%lld",&matrix[i][j]);
if(matrix[i][j]<0)
symetry = false;
}
}
pf("Test #%d: ",cs++);
if(!symetry)
{
pf("Non-symmetric.\n");
continue;
}
is_symetry();
if(symetry)
pf("Symmetric.\n");
else
pf("Non-symmetric.\n");
}
return 0;
}
Md. Nazmul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<cstring>
#include<sstream>
#include<cmath>
#include <iomanip>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
int test,dimen,cs=1;
long long matrix[105][105];
bool symetry;
void is_symetry()
{
if(!symetry)
return;
for(int i=0 ; i<dimen ; i++)
{
for(int j=0 ; j<dimen ; j++)
{
if(matrix[i][j] != matrix[dimen-1-i][dimen-1-j])
{
symetry = false;
return ;
}
}
}
}
int main()
{
char str[1001];
sc("%d",&test);
while(test--)
{
getchar();
gets(str);
symetry = true ;
sscanf(str,"%c = %d",&str[0],&dimen);
for(int i=0 ; i<dimen ; i++)
{
for(int j=0 ; j<dimen ; j++)
{
sc("%lld",&matrix[i][j]);
if(matrix[i][j]<0)
symetry = false;
}
}
pf("Test #%d: ",cs++);
if(!symetry)
{
pf("Non-symmetric.\n");
continue;
}
is_symetry();
if(symetry)
pf("Symmetric.\n");
else
pf("Non-symmetric.\n");
}
return 0;
}
No comments:
Post a Comment