Codeforces 821A Okabe and Future Gadget Laboratory 题解
来源:互联网 发布:钢雨篷计算软件 编辑:程序博客网 时间:2024/05/20 18:55
题意
给你一个由正整数组成的n阶矩阵,判断它是否满足所有不为1的数均可表示为与它同行的一个数和与它同列的一个数的和这个条件
思路
暴力枚举判断即可
代码
#include <cstdio>int a[51][51];int main(){ int n; bool ans,t; scanf("%d",&n); for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%d",&a[i][j]); ans=true; for(int i=0;i<n&&ans==true;i++) for(int j=0;j<n;j++) if(a[i][j]!=1) { t=false; for(int k=0;k<n&&t==false;k++) for(int l=0;l<n;l++) if(a[i][k]+a[l][j]==a[i][j]) { t=true; break; } if(t==false) { ans=false; break; } } if(ans) printf("Yes\n"); else printf("No\n"); return 0;}
阅读全文
0 0
- Codeforces 821A 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 Round #420 A. Okabe and Future Gadget Laboratory
- Okabe and Future Gadget Laboratory CodeForces
- A. Okabe and Future Gadget Laboratory
- CodeFroces 821A Okabe and Future Gadget Laboratory
- Okabe and Future Gadget Laboratory
- Codeforces Round #420 (Div. 2) A. Okabe and Future Gadget Laboratory
- #420 A. Okabe and Future Gadget Laboratory(Div.2)
- CF #420 A. Okabe and Future Gadget Laboratory
- CF821A-Okabe and Future Gadget Laboratory
- Codeforces821A Okabe and Future Gadget Laboratory
- #420 Div.2 A. Okabe and Future Gadget Laboratory——暴力
- Codeforces 821D Okabe and City 题解
- Codeforces 821C Okabe and Boxes 题解
- Codeforces 821B Okabe and Banana Trees 题解
- 深入理解操作系统原理之操作系统概述
- 面试题30_相关题目(最小的k个数_方法二)
- 图像和流媒体 -- I 帧,B帧,P帧,IDR帧的区别
- HDU1663The Counting Problem
- hashids 加密 id
- Codeforces 821A Okabe and Future Gadget Laboratory 题解
- html中select标签刷新后不回到默认值而是保持之前选择值
- 1、JDK初步与HelloWorld
- JQuery banner轮播
- 内存泄露详解
- 文章标题
- 文章标题
- java 文件读写操作应用模块【工具包系列】
- opencv中IplImage, CvMat, Mat 数据结构的使用简介