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 ...
随机推荐
- luoguP2365 任务安排 斜率优化 + 动态规划
Code: #include<bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) # ...
- vim 批量添加删除注释
vim中单行注释只是多行注释的一个特例,这里统一进行多行注释的讲解 (1)添加批量注释 ctrl+v 进入列编辑模式,向下或向上移动光标,把需要注释的行的开头标记起来,然后按大写的I(shift+i) ...
- 攻防世界 | guess_num
查源码发现v5可以覆盖sreed[0],这样这个随机数列就可控了 在随机种子这里我一开始使用devC++来生成,居然结果跟gcc的不一样
- sqlserver库相关-表相关-3
原文: https://www.cnblogs.com/wlx520/p/4684441.html 库相关 建库 --创建School数据库之前:首先判断数据库是否存在,若存在则删除后再创建,若不存在 ...
- 定时任务cron表达式解析
cron表达式2种: Seconds Minutes Hours DayofMonth Month DayofWeek Year或 Seconds Minutes Hours DayofMonth M ...
- Java实践-远程调用Shell脚本并获取输出信息
1.添加依赖 <dependency> <groupId>ch.ethz.ganymed</groupId> <artifactId>ganymed-s ...
- UNITY编辑器模式下static变量的坑
在unity中写编辑器扩展工具,如在编辑器中加个菜单,点击这个菜单项时执行打包功能. 类如下,其中的静态变量,如果每次进来不清空,则LIST会越来越大,打包函数执行完后系统不会帮我们清空 #if UN ...
- Nginx 官网文档翻译汇总
Nginx 官网文档,各个模块的手册在这里. Nginx 中文文档 - 淘宝翻译 改版后的新 Nginx 官网文档 概述 新手指南 控制 Nginx 管理员指南 Admin Guide 安装 基本功能 ...
- 把Notepad++的tab设置为四个空格
在7.1版本以及以后 设置->首选项->Language 勾选Repalce by space 在7.1版本以前 设置->首选项->制表符设置 右侧,转为空格,勾选上 参考: ...
- postman+xmysql实现postman与数据库的交互,获取数据库的值来作为参数进行请求
安装nodejs和npm详细步骤:https://www.runoob.com/nodejs/nodejs-install-setup.html 安装xmysql 执行命令: npm install ...