Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Solution {
- public static void main(String args[]) {
- Scanner in = new Scanner(System.in);
- int R = in.nextInt();
- int C = in.nextInt();
- int K = in.nextInt();
- int count1 = 0;
- in.nextLine();
- for (int i = 0; i < R; i++) {
- String val = in.nextLine();
- for (int j = 0; j < val.length(); j++)
- count1 += val.charAt(j) == '1' ? 1 : 0;
- }
- System.out.println(R * C < K ? (R * C - 1) : (count1 + K));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement