Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
int main(int argc, const char * argv[]) { int n, m; scanf("%d%d", &n, &m); int mat[n][m]; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { scanf("%d", &mat[i][j]); } } int najgolem_zbir = 0; int najgolema_kolona = 0; for(int j = 0; j < m; j++) { int zbir = 0; for(int i = 0; i < n; i++) { zbir += mat[i][j]; } if(zbir > najgolem_zbir) { najgolem_zbir = zbir; najgolema_kolona = j; } } int najgolem_zbir2 = 0; int najgolema_kolona2 = 0; for(int j = 0; j < m; j++) { int zbir = 0; for(int i = 0; i < n; i++) { zbir += mat[i][j]; } if(zbir > najgolem_zbir2 && j != najgolema_kolona) { najgolem_zbir2 = zbir; najgolema_kolona2 = j; } } for(int i = 0; i < n; i++) { int pom = mat[i][najgolema_kolona]; mat[i][najgolema_kolona] = mat[i][najgolema_kolona2]; mat[i][najgolema_kolona2] = pom; } for(int i = 0; i < n / 2; i++) { int pom = mat[i][najgolema_kolona]; mat[i][najgolema_kolona] = mat[n - i - 1][najgolema_kolona]; mat[n - i - 1][najgolema_kolona] = pom; } for(int i = 0; i < n / 2; i++) { int pom = mat[i][najgolema_kolona2]; mat[i][najgolema_kolona2] = mat[n - i - 1][najgolema_kolona2]; mat[n - i - 1][najgolema_kolona2] = pom; } for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { printf("%d ", mat[i][j]); } printf("\n"); } return 0; } /* 1 2 3 4 5 6 7 8 2 1 2 3 4 5 6 7 3 4 5 6 7 8 9 10 4 5 6 7 8 9 10 0 5 6 7 8 9 10 0 1 6 7 8 9 10 0 1 2 **/
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)