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 |
干嘛说答案啊?给别人留一点解题的快感嘛In Reply To:只需要判断同一列的元素与前一列的差值都相等,就是homogeneous否则就不是 Posted by:ACM_Hohai at 2008-11-04 15:50:34 > #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