AC代码
#include<stdio.h>
int main()
{
int a[][];
int b[];
int i,j,t,n;
while(scanf("%d",&n)!=EOF)
{
int flag = ;//用于标示数组b中是否存在不是-1的元素
for(i=;i<n;i++)
for(j=;j<n;j++)
scanf("%d",&a[i][j]); //找出每一行中最大的元素,并把列号存在数组b中
for(i=;i<n;i++)
{
//默认每一行第一个元素为最大值
b[i] = a[i][];
//引入一个循环变量t用来记录最大值的列号
t = ;
//把最大值的数值暂时存在b中,把最大值的列号暂时存在t中
for(j=;j<n;j++)
{
if(b[i]<a[i][j])
{
b[i] = a[i][j];
t = j;
}
}
//如果一行中有两个相同的最大值,t等于-1
for(j=;j<n;j++)
{
if(b[i]==a[i][j]&&j!=t)
{
t = -;
}
}
//把最大值的列号存在b中
b[i] = t;
} for(i=;i<n;i++)
{
if(b[i]!=-)
{
for(j=;j<n;j++)
{
if(a[i][b[i]]>a[j][b[i]])
{
b[i] = -;
}
else if(a[i][b[i]]==a[j][b[i]]&&i!=j)
{
b[i] = -;
}
}
}
}
for(i=;i<n;i++)
{
if(b[i]!=-)
{
flag = ;
printf("%d %d\n",i,b[i]);
}
}
if(flag==)
{
printf("NO\n");
}
}
return ;
}
AC失败,但输出好像并没有问题
#include<stdio.h>
int main()
{
int n,a[][],i,j;
while(scanf("%d",&n)!=EOF)
{
int flag=,x=,y=,x1=;
for(i=;i<n;i++)
for(j=;j<n;j++)
scanf("%d",&a[i][j]);
for(i=;i<n;i++)
{
for(j=;j<n;j++)
{
if(a[i][j]>a[x][y])
y=j;
}
for(int t=,y=j;t<n;t++)
{
if(a[t][j]<a[x1][j])
x1=t;
}
}
if(x1==x)
{
printf("%d %d\n",x1,y);
flag;
}
else
{
printf("NO\n");
flag=;
}
}
return ;
}

Problem E: 矩阵鞍点的更多相关文章

  1. HDU1757-A Simple Math Problem,矩阵快速幂,构造矩阵水过

    A Simple Math Problem 一个矩阵快速幂水题,关键在于如何构造矩阵.做过一些很裸的矩阵快速幂,比如斐波那契的变形,这个题就类似那种构造.比赛的时候手残把矩阵相乘的一个j写成了i,调试 ...

  2. hdu 1757 A Simple Math Problem (乘法矩阵)

    A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  3. HDU----(4291)A Short problem(快速矩阵幂)

    A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  4. hdu 1757 A Simple Math Problem(矩阵快速幂乘法)

    Problem Description Lele now is thinking about a simple function f(x). If x < f(x) = x. If x > ...

  5. hdu 4291 A Short problem(矩阵+取模循环节)

    A Short problem                                                          Time Limit: 2000/1000 MS (J ...

  6. HDU-1757--A Simple Math Problem(矩阵乘法)

    Problem Description Lele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x > ...

  7. HDU 4291 A Short problem(矩阵+循环节)

    A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  8. A Simple Math Problem(矩阵快速幂)(寒假闭关第一题,有点曲折啊)

    A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...

  9. HDU1757:A Simple Math Problem(矩阵快速幂)

    http://acm.hdu.edu.cn/showproblem.php?pid=1757 Problem Description Lele now is thinking about a simp ...

随机推荐

  1. GNU Readline 库及编程简介【转】

    转自:https://www.cnblogs.com/hazir/p/instruction_to_readline.html 用过 Bash 命令行的一定知道,Bash 有几个特性: TAB 键可以 ...

  2. 【LOJbeta round1】ZQC的手办

    NOI2012-超级钢琴的升级版. 用线段树维护最小值及其出现位置,接下来就跟超级钢琴一个做法了. #include<bits/stdc++.h> #define N 500010 #de ...

  3. 2017多校第7场 HDU 6127 Hard challenge 极角排序,双指针

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6127 题意:平面直角坐标系上有n个整点,第i个点有一个点权val​,坐标为(xi,yi),其中不存在任 ...

  4. VI编辑,backspace无法删除解决方法

    系统ubuntu 1,sudo apt-get install vim  安装vim 2, sudo vi  /etc/vim/vimrc.tiny 修改 set compatible为set noc ...

  5. linux命令(4):vmstat命令

    CPU监控如下: vmstat 2 10  //表示每隔2秒运行10次 内存监控如下: vmstat –s 监控进程及CPU.内存状态 如下: top

  6. AC日记——[POI2008]BLO-Blockade 洛谷 [POI2008]BLO-Blockade

    [POI2008]BLO-Blockade 思路: tarjan: 代码: #include <bits/stdc++.h> using namespace std; #define ma ...

  7. AC日记——[Sdoi2010]粟粟的书架 bzoj 1926

    1926 思路: 主席树+二分水题: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 500005 #defi ...

  8. hdu 5576 dp

    题目大意:给你一个长度为 n 的 字符串表示一个乘法,一次操作随机选两个字符进行交换,进行m次操作,让你求出所有可能操作 的答案和.  (1 <= n, m <= 50) 思路:巨难.. ...

  9. sprint定时任务执行两次

    我这里遇到的是tomcat问题,把appBase设置为空 <Host name="localhost" appBase="" unpackWARs=&qu ...

  10. C/C++ 基础知识

    C/C++ 基础知识 C 语言优秀学习网站 [C Programming Language] C 语言的注释 单行注释 /* comment goes here */ // comment goes ...