Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
9658 | 艾张皓 | 求元素在矩阵中的位置 | C++ | Accepted | 4 MS | 736 KB | 409 | 2021-04-14 20:39:30 |
#include<bits/stdc++.h> using namespace std; int a[1000][1000]; int main() { int n,t; cin>>n>>t; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cin>>a[i][j]; } } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(a[i][j]==t) { cout<<i<<" "<<j; return 0; } if(a[i][j]==a[n-1][n-1]) { cout<<"-1"; return 0; } } } return 0; }