fork(1) download
  1. #include <stdio.h>
  2. int main() {
  3. int n, n1, arr[250001];
  4. scanf("%d %d", &n, &n1);
  5. int max = 0;
  6. int pos = 0;
  7. for (int i = 1; i <= n * n1; i++) scanf("%d", &arr[i]);
  8. for (int i = 1; i <= n; i++) {
  9. int c = 0;
  10. for (int j = i; j <= n1 * n; j += n) c += arr[j];
  11. if (max <= c) {
  12. max = c;
  13. pos = i;
  14. }
  15. }
  16. printf("%d", pos);
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/257384/101
Success #stdin #stdout 0s 4528KB
stdin
2
2
1
2
3
4
stdout
2