Advertisement
Guest User

Untitled

a guest
Sep 1st, 2020
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. class Solution {
  4.  
  5. public static void main(String args[]) {
  6. Scanner in = new Scanner(System.in);
  7. int R = in.nextInt();
  8. int C = in.nextInt();
  9. int K = in.nextInt();
  10. int count1 = 0;
  11. in.nextLine();
  12. for (int i = 0; i < R; i++) {
  13. String val = in.nextLine();
  14. for (int j = 0; j < val.length(); j++)
  15. count1 += val.charAt(j) == '1' ? 1 : 0;
  16. }
  17. System.out.println(R * C < K ? (R * C - 1) : (count1 + K));
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement