Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int n , arr[100][100] = {0} , i = 0 , j =0;
- void Nhapmt()
- {
- scanf("%d",&n);
- for (i =0 ; i < n ; i++)
- {
- for (j =0 ; j < n ; j++)
- {
- scanf("%d",&arr[i][j]);
- }
- }
- }
- int CotLonNhat()
- {
- int tong =0 , max = 0 , temp = 0 ;
- for (i =0 ; i < n ; i++)
- {
- for (j =0 ; j < n ; j++)
- {
- tong += arr[j][i];
- }
- if (tong > max)
- {
- max = tong ;
- }
- tong = 0;
- }
- for (i =n-1 ; i>=0 ; i--)
- {
- for (j =0 ; j < n ; j++)
- {
- tong += arr[j][i];
- }
- if (tong == max)
- {
- temp = i;
- }
- tong = 0;
- }
- return temp;
- }
- int main()
- {
- Nhapmt();
- printf("%d \n",CotLonNhat() + 1);
- for (i =0 ; i < n ; i++)
- {
- for (j =0 ; j < n; j++)
- {
- if (j == CotLonNhat())
- {
- printf("%d ",arr[i][j]);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement