1 条题解
-
0
C :
#include <stdio.h> #include <stdlib.h> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int i,j,n,a[6][6],b=0,x,y; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); if(abs(a[i][j])>abs(b)) { b=a[i][j]; x=i+1; y=j+1; } } } printf("%d %d %d",b,x,y); return 0; }
C++ :
#include<iostream> using namespace std; int main() { int n,a[7][7]; cin>>n; for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) cin>>a[i][j]; int max=a[1][1],x=1,y=1; for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) if (max<a[i][j]) { max=a[i][j]; x=i; y=j; } cout<<max<<" "<<x<<" "<<y<<endl; return 0; }
- 1
信息
- ID
- 1937
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- (无)
- 递交数
- 0
- 已通过
- 0
- 上传者