CodeFroces 821A Okabe and Future Gadget Laboratory
来源:互联网 发布:python 使用相对路径 编辑:程序博客网 时间:2024/06/05 15:57
http://codeforces.com/problemset/problem/821/A
题意很简单,就是说一个n*n的矩阵中是否有不为1的数字是无法从同一行的一个数字+同一列的一个数字加起来,如果存在这样的数字输出no,否则输出yes。
You can output each letter in upper or lower case.
代码如下:
#include<bits/stdc++.h>using namespace std;int n, G[55][55];bool Check(int x, int y){for(int i = 0; i < n; i++){for(int j = 0; j < n; j++){if(y == i || x == j)continue;if(G[x][i] + G[j][y] == G[x][y])return 1;}}return 0;}int main(){bool flag = 1;cin >> n;for(int i = 0; i < n; i++)for(int j = 0; j < n; j++)cin >> G[i][j];for(int i = 0; i < n; i++)for(int j = 0; j < n; j++){if(G[i][j] != 1){if(!Check(i, j)){flag = 0;//cout << i << " " << j << endl;}}}if(flag)cout << "Yes" << endl;elsecout << "No" << endl;return 0;}
阅读全文
0 0
- CodeFroces 821A Okabe and Future Gadget Laboratory
- A. Okabe and Future Gadget Laboratory
- Codeforces 821 A. Okabe and Future Gadget Laboratory
- Codeforces 821A-Okabe and Future Gadget Laboratory
- Codeforces 821A Okabe and Future Gadget Laboratory 题解
- CodeForces 821A Okabe and Future Gadget Laboratory
- Okabe and Future Gadget Laboratory
- #420 A. Okabe and Future Gadget Laboratory(Div.2)
- CF #420 A. Okabe and Future Gadget Laboratory
- Codeforces Round #420 A. Okabe and Future Gadget Laboratory
- CF821A-Okabe and Future Gadget Laboratory
- Codeforces821A Okabe and Future Gadget Laboratory
- Okabe and Future Gadget Laboratory CodeForces
- Codeforces Round #420 (Div. 2) A. Okabe and Future Gadget Laboratory
- #420 Div.2 A. Okabe and Future Gadget Laboratory——暴力
- CodeFroces 821C Okabe and Boxes(栈?)
- Codefroces 821B Okabe and Banana Trees(暴力)
- Codefroces 280 div2 A. Vanya and Cubes
- 声明一个变量
- AsyncTask+httpurl
- 很全的php数组操作方法
- Java基础3-----数组
- Android学习--多媒体功能:接收和发送短信
- CodeFroces 821A Okabe and Future Gadget Laboratory
- UVa679
- Java中的序列化Serialable高级详解
- AD9如何设置原点位置
- 日均5000万订单点餐系统中间件选型和关键技术实现方案
- 海康摄像头实时读取+opencv显示
- PHP session锁:如何避免session阻塞PHP请求
- Hdu1205 吃糖果
- 第三章 Linux内核及内核编程