Codeforces Round #420 (Div. 2) - A
题目链接:http://codeforces.com/contest/821/problem/A
题意:给定一个n*n的矩阵。 问你这个矩阵是否满足矩阵里的元素除了1以外,其他元素都可以在该元素的行和列分别找一个数然后相加等于它自身。
思路:按照题意暴力判断即可。
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<time.h>
#include<cmath>
using namespace std;
typedef long long int LL;
const LL INF = ;
const int MAXN = + ;
int val[MAXN][MAXN];
int main(){
//#ifdef kirito
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
//#endif
// int start = clock();
int n;
while (~scanf("%d",&n)){
for (int i = ; i < n; i++){
for (int j = ; j < n; j++){
scanf("%d", &val[i][j]);
}
}
bool flag = true;
for (int i = ; i < n&&flag; i++){
for (int j = ; j < n&&flag; j++){
if (val[i][j] == ){
continue;
}
bool k = false;
for (int xi = ; xi < n; xi++){
for (int xj = ; xj < n; xj++){
if (val[i][j] == val[i][xj] + val[xi][j]){
k = true;
break;
}
}
}
if (k == false){
flag = false;
}
}
}
printf(flag ? "Yes\n" : "No\n");
}
//#ifdef LOCAL_TIME
// cout << "[Finished in " << clock() - start << " ms]" << endl;
//#endif
return ;
}
Codeforces Round #420 (Div. 2) - A的更多相关文章
- 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes
		
[题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...
 - 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees
		
[题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...
 - 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory
		
[题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...
 - Codeforces Round #420 (Div. 2) - C
		
题目链接:http://codeforces.com/contest/821/problem/C 题意:起初有一个栈,给定2*n个命令,其中n个命令是往栈加入元素,另外n个命令是从栈中取出元素.你可以 ...
 - Codeforces Round #420 (Div. 2) - E
		
题目链接:http://codeforces.com/contest/821/problem/E 题意:起初在(0,0),现在要求走到(k,0),问你存在多少种走法. 其中有n条线段,每条线段为(a, ...
 - Codeforces Round #420 (Div. 2) - B
		
题目链接:http://codeforces.com/contest/821/problem/B 题意:二维每个整点坐标(x,y)拥有的香蕉数量为x+y,现在给你一个直线方程的m和b参数,让你找一个位 ...
 - Codeforces Round #420 (Div. 2)
		
/*************************************************************************************************** ...
 - Codeforces Round #420 (Div. 2) A,B,C
		
A. Okabe and Future Gadget Laboratory time limit per test 2 seconds memory limit per test 256 megaby ...
 - Codeforces Round #420 (Div. 2) E. Okabe and El Psy Kongroo 矩阵快速幂优化dp
		
E. Okabe and El Psy Kongroo time limit per test 2 seconds memory limit per test 256 megabytes input ...
 
随机推荐
- Zabbix分布式监控系统实践
			
https://www.zabbix.com/wiki/howto/install/Ubuntu/ubuntuinstall 环境介绍OS: Ubuntu 10.10 Server 64-bitSer ...
 - LINUX的一些基本概念和操作
			
LINUX和shell的关系: linux是核,是操作系统,用于分配软硬件资源,用于支持运行环境,shell是壳,是命令解析器. linux命令: linux命令行有一个输入输出的行为,输入命令,输出 ...
 - NIO编程之多客户端聊天系统
			
1. 服务端 import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; im ...
 - 深圳市利汇电子商务科技有限公司2019年java面试笔试题
			
垃圾公司,建议不要去,写的地址去了发现是两个公司公用一个办公场地,还没有公司的招牌,去了交简历给前台然后就是 填一份求职申请,一份笔试题如下,然后就等待,先是人事的一个小妹妹面试,问一些个人问题,为什 ...
 - 【CF1257F】Make Them Similar【meet in the middle+hash】
			
题意:给定n个数,让你给出一个数,使得n个数与给出的数异或后得到的数的二进制表示中1的数量相同 题解:考虑暴搜2^30去找答案,显然不可接受 显然可以发现,这是一个经典的meet in the mid ...
 - js点击获取—通过JS获取图片的绝对对坐标位置
			
一.通过JS获取鼠标点击时图片的相对坐标位置 源代码如下所示: <!DOCTYPE html> <html lang="en"> <head> ...
 - Microsoft SQL Server   简介
			
SQL Server 是Microsoft 公司推出的关系型数据库管理系统.具有使用方便可伸缩性好与相关软件集成程度高等优点,可跨越从运行Microsoft Windows 98 的膝上型电脑到运行M ...
 - git cherry-pick的使用
			
[Git] Git整理(五) git cherry-pick的使用 2018年07月13日 23:49:16 FightFightFight 阅读数:31649 版权声明:本文为博主原创文章,未 ...
 - ProxyImpl 类
			
package com.test.mvp.mvpdemo.mvp.v7.proxy; import com.test.mvp.mvpdemo.mvp.v7.basemvp.BasePresenter; ...
 - vue2.0 之 douban (五)创建cell,media-cell组件
			
1.组件cell 这里的cell分为三种样式,左侧带图标,不带图标,以及左侧带竖线的cell. 每一个组件都有一个底部边框: 这里我们采用了移动端1px像素问题的解决方法:父级元素设置相对定位,构建1 ...