ZUFEOJ
Home
ProblemSet
Source/Category
Contest
Status
Ranklist
F.A.Qs
Login
Register
6486: 模拟卷1:程序阅读3 找位置
内存限制:256 MB
时间限制:2 S
题面:传统
评测方式:文本比较
上传者:
提交:1
通过:1
提交
提交记录
统计
Web Board
题目描述
#include <iostream>
using namespace std;
int n,k,answerx,answery;
int a[5001][5001];
void FindKPosition()
{
int i = n,j = n;
while (j > 0)
{
if (a[n][j] < k) break;
j --;
}
j++;
while (a[i][j] != k)
{
while (a[i][j] > k&& i > 1) i --;
while (a[i][j] < k&& j <= n) j ++;
}
answerx = i;
answery = j;
}
int main()
{
int i,j;
cin >> n;
for (i = 1;i <= n;i ++)
for (j = 1;j <= n;j ++)
cin >> a[i][j];
cin >> k;
FindKPosition();
cout << answerx << " " << answery << endl;
return 0;
}
输入样例
复制
3 1 2 3 4 5 6 7 8 9 6
输出样例
复制
2 3