sdut 2317 Homogeneous squares

http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2371

View Code
 1 #include <iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 long int a[1005][1005];
 5 int main()
 6 {
 7     int n,flag,i,j;
 8     while(~scanf("%d",&n))
 9     {
10         if(n==0)
11         break;
12         for(i=0;i<n;i++)
13         for(j=0;j<n;j++)
14         scanf("%ld",&a[i][j]);
15         flag=1;
16         for(i=0;i<n-1;i++)
17         {
18             long temp=a[i][0]-a[i+1][0];
19             for(j=1;j<n;j++)
20             {
21                 if(temp!=a[i][j]-a[i+1][j])
22                 {
23                     flag=0;
24                     break;
25                 }
26 
27             }
28             if(!flag)
29             break;
30         }
31         if(flag)
32         printf("homogeneous\n");
33         else
34         printf("not homogeneous\n");
35     }
36     return 0;
37 }

转载于:https://www.cnblogs.com/wanglin2011/archive/2012/08/28/2661016.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值