Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
4659 | fs_5028 | 求元素在矩阵中的位置 | C++ | Wrong Answer | 0 MS | 264 KB | 353 | 2024-08-27 18:44:08 |
#include<iostream> using namespace std; int main(){ int n[100][100],m,a,b,c,i=0,j=0; cin>>a>>m; for(b=1;b<=a;b++){ for(c=1;c<=a;c++){ cin>>n[b][c]; } } for(b=1;b<=a;b++){ for(c=1;c<=a;c++){ if(n[b][c]==m){ i=b; j=c; } } } if(i>=0&&j>=0){ cout<<i<<" "<<j; } else{ cout<<"-1"; } }
------Input------
3 2 1 4 7 2 5 8 3 6 9
------Answer-----
1 0
------Your output-----
2 1