#420 Div.2 A. Okabe and Future Gadget Laboratory——暴力
来源:互联网 发布:C语言的根号 编辑:程序博客网 时间:2024/06/08 14:19
题目链接:http://codeforces.com/contest/821/problem/A
AB题都是暴力
暴力水题,甚至觉得 B 比 A 简单
题意:如果这个矩阵里每个不是 1 的数都可以表示为纵向方向上的一个数和横向方向上的一个数之和 则输出 Yes 否则 No
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define mem(s,t) memset(s,t,sizeof(s))#define D(v) cout<<#v<<" "<<v<<endl#define inf 0x3f3f3f3fconst int N =55;int a[N][N];//#define LOCALint main() {#ifdef LOCAL freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);#endif int n; scanf("%d",&n); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ scanf("%d",&a[i][j]); } } int bad=0; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(a[i][j]==1) continue; else{ int ok=0; for(int s=0;s<n;s++){ if(s==i) continue; for(int t=0;t<n;t++){ if(t==j) continue; if(a[i][t]+a[s][j]==a[i][j]){ ok=1;break; } } if(ok) break; } if(ok) bad=0; else {bad=1;break;} } } if(bad) break; } if(!bad) puts("Yes"); else puts("No"); return 0;}
阅读全文
0 0
- #420 Div.2 A. Okabe and Future Gadget Laboratory——暴力
- #420 A. Okabe and Future Gadget Laboratory(Div.2)
- Codeforces Round #420 (Div. 2) A. Okabe and Future Gadget Laboratory
- A. Okabe and Future Gadget Laboratory
- CF #420 A. Okabe and Future Gadget Laboratory
- Codeforces Round #420 A. Okabe and Future Gadget Laboratory
- 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 题解
- CodeFroces 821A Okabe and Future Gadget Laboratory
- CodeForces 821A Okabe and Future Gadget Laboratory
- CF821A-Okabe and Future Gadget Laboratory
- Codeforces821A Okabe and Future Gadget Laboratory
- Okabe and Future Gadget Laboratory CodeForces
- #420 Div.2 B. Okabe and Banana Trees——数学&暴力
- #420 Div.2 C. Okabe and Boxes——模拟
- Codeforces Round #420 (Div. 2) 821D Okabe and City
- 00104 python自建函数入门
- 隐写术-guess
- 原型模式、对象克隆(深复制、浅复制)
- Myeclipse用link安装方法安装svn插件
- Redis
- #420 Div.2 A. Okabe and Future Gadget Laboratory——暴力
- AES加密解密源码
- JAVA基础笔记_17-06-26
- android 全局对话框(不依赖具体activity)
- 配置IIS Express,支持JSON
- spark1.x-streaming
- Unity5.x shader打包AssetBundle总结
- 00105 python类
- iptables--知识总结1