海選女主角:
#include<iostream> #include<cmath> using namespace std; int main(){ int m,n; while(cin>>m>>n){ int i,j; int max=0; int column=0,row=0; int a; for(i=1;i<=m;++i){ for(j=1;j<=n;++j){ cin>>a; if(abs(a)>abs(max)){ max=a; column=i; row=j; } } } if(max==0) cout<<"1 1 0"<<endl; else cout<<column<<" "<<row<<" "<<max<<endl; } return 0; }
本文出自 “菜鳥的進階之路” 博客,請務必保留此出處http://beyond316.blog.51cto.com/7367775/1272551