华东交通大学2016年ACM“双基”程序设计竞赛 1002
Problem Description
Input
Output
Sample Input
5
1 2 3 4 5
0 0 0 0 4
0 0 0 0 3
0 0 0 0 2
0 0 0 0 1
Sample Output
1
Author
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define INF 0x3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
LL x[10010],y[10010];
LL a[10010][10010];
int main()
{
int n;
while(~scanf("%d",&n))
{
LL cnt=0;
LL Max;
LL Min;
LL pos1,pos2;
int cot1;
int cot2;
memset(x,0,sizeof(x));
memset(y,0,sizeof(y));
for(int i=1;i<=n;i++)
{
Min=2e11;
pos1=0;
cot1=0;
for(int j=1;j<=n;j++)
{
cin>>a[i][j];
if(a[i][j]<Min)
{
Min=a[i][j];
pos1=j;
}
}
for(int j=1; j<=n; j++)
{
if(a[i][j]==Min)
{
cot1++;
}
}
if(cot1==1)
{
x[i]=pos1;
}
else
{
x[i]=-1;
}
}
for(int i=1;i<=n;i++)
{
Max=-1;
pos2=0;
cot2=0;
for(int j=1;j<=n;j++)
{
// cin>>a[i][j];
if(a[j][i]>Max)
{
Max=a[j][i];
pos2=j;
}
}
for(int j=1; j<=n; j++)
{
if(a[j][i]==Max)
{
cot2++;
}
}
if(cot2==1)
{
y[i]=pos2;
}
else
{
y[i]=-1;
}
}
for(int i=1;i<=n;i++)
{
if(x[i]!=-1&&y[x[i]]==i)
{
cnt++;
}
}
printf("%d\n",cnt);
}
return 0;
}
华东交通大学2016年ACM“双基”程序设计竞赛 1002的更多相关文章
- 华东交通大学2016年ACM“双基”程序设计竞赛 1010
Problem Description LB是个十分喜欢钻研的人,对什么事都要搞明白.有一天他学习到了阶乘,他十分喜欢,所以他在想一个问题.如果给定一个数n,求n!能不能被2016整除.LB算了好久都 ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1007
Problem Description ACM小学妹在今天的暑假训练结束后,想看球赛放松一下.当他打开电脑时查询到联盟今天直播N场球赛,每场球赛的起止时间(S1,E1),(S2,E2),...,(SN ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1001
Problem Description 输入一个非负的int型整数,是奇数的话输出"ECJTU",是偶数则输出"ACM". Input 多组数据,每组数据输入一 ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1008
Problem Description halfyarn找你写个简单的题?好哒!给你n个整数,现在要求你选择两个位置的数,例如选择第pos_a个数a,和第pos_b个数b,给定ans=min(a,b) ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1005
Problem Description 最近侯ry感觉自己在数学方面的造诣不忍直视:他发现他的学习速率呈一个指数函数递增,疯狂的陷入学习的泥潭,无法自拔:他的队友发现了他的学习速率y=e^(b*lna ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1004
Problem Description LB是个十分喜欢钻研的人,对什么事都要搞明白.有一天他看到一个公式,((a-b)*c+d*e)/f=k.他想如果给定K的值,一共有多少种不同整数的组合(a,b, ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1009
Problem Description 华盛顿在寝室洗衣服,遭到了xyf的嫌弃,于是xyf出了道题给华盛顿来做(然而并没有什么关系-v-!)xyf扔给华盛顿n个字符串,这些字符串的长度不超过10000 ...
- 华东交通大学2016年ACM“双基”程序设计竞赛 1003
Problem Description 风雨漂泊异乡路, 浮萍凄清落叶飞. 游子寻根满愁绪,一朝故土热泪归.Hey ecjtuer! 刚刚学习了二叉树的知识,现在来考察一下..给你一个深度为h的满二叉 ...
- 华东交通大学2015年ACM“双基”程序设计竞赛1002
Problem B Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Sub ...
随机推荐
- HDU 4573 Throw the Stones(动态三维凸包)(2013 ACM-ICPC长沙赛区全国邀请赛)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A fe ...
- struts文件上传(单文件)
第01步:配置web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...
- java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
1.system32添加sapjco3.dll 2.tomcat bin下添加sapjco3.dll 3.项目中添加sapjco3.jar 包
- 【ruby】安装Ruby
系统需求 首先确定操作系统环境,不建议在 Windows 上面搞,所以你需要用: Mac OS X 任意 Linux 发行版本 配置系统包 $ sudo apt-get install -y buil ...
- Sql Server 检测死锁的SQL语句
首先创建一个标量值函数DigLock,用来递归检测SqlServer中的每一个会话是否存在加锁循环,如果该函数最终返回1则表示检测到了加锁循环 (也就是说检测到了死锁),如果最终返回0则表示没有检测到 ...
- Bonbo Git Server
Install This page covers simple Bonobo Git Server installation. Be sure to check prerequisites page ...
- TortoiseSVN提交文件的时候卡死
提交文件的时候卡死,查找很久,才发现原来是IP被修改了,郁闷
- UIView的ContentMode
UIViewContentMode typedef enum { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectF ...
- TI CC254x BLE教程 3
通用属性配置(Generic Attribute Profiles) 1. 数据在services里面以特征字(characteristics)的形式展示出来 如你所见, 特征字包含属性(Proper ...
- zabbix如何实现微信报警 转载
现实生产环境中,我们通常使用邮件和短信接受zabbix报警信息,但是邮件经常被工作人员搁置在角落中甚至被设置为垃圾邮件被过滤掉.公司的短信接口又太贵,复杂环境中使用短息报警会使运维成本增加很多.微信提 ...