Advertisement
AquaBlitz11

[t104] Exam Checking

Oct 9th, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. const int N = 510;
  4. char S[N], T[N];
  5.  
  6. int main()
  7. {
  8.     int n, m;
  9.     scanf("%d %s%d", &n, S, &m);
  10.     int best = -1, bestix;
  11.     for (int i = 1; i <= m; ++i) {
  12.         scanf(" %s", T);
  13.         int cnt = 0;
  14.         for (int j = 0; j < n; ++j) {
  15.             if (S[j] == T[j])
  16.                 ++cnt;
  17.         }
  18.         if (i > 1) printf(" ");
  19.         printf("%d", cnt);
  20.         if (cnt > best) {
  21.             best = cnt;
  22.             bestix = i;
  23.         }
  24.     }
  25.     printf("\n#%d: %d\n", bestix, best);
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement