| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
只需要判断同一列的元素与前一列的差值都相等,就是homogeneous否则就不是#include<iostream>
using namespace std;
int data[1001][1001];
int dot[1001];
int main()
{
int n;
bool flag=true;
while(cin>>n&&n!=0) {
flag=true;
for(int i=0;i<n;i++) {
cin>>data[0][i];
if(i>0) {
dot[i]=data[0][i]-data[0][i-1];
}
}
for(int j=1;j<n;j++) {
for(int i=0;i<n;i++) {
cin>>data[j][i];
if(i>0) {
if(data[j][i]-data[j][i-1]!=dot[i]) {
flag=false;
}
}
}
}
if(flag) {
cout<<"homogeneous"<<endl;
}
else
{
cout<<"not homogeneous"<<endl;
}
}
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator