Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //public class soluce..
- public static Map<String, Integer> hash = new HashMap<>();
- public static void main(String[] args)
- {
- //connect();
- Scanner in = new Scanner(System.in);
- hash.put("c",in.nextInt());
- hash.put("b",in.nextInt());
- hash.put("bc",in.nextInt());
- hash.put("a",in.nextInt());
- hash.put("ac",in.nextInt());
- hash.put("ab",in.nextInt());
- hash.put("abc",in.nextInt());
- while(getSumOfX("a")%2 != 0 || getSumOfX("b")%2 != 0 || getSumOfX("c")%2 != 0)
- {
- for(String s : hash.keySet())
- {
- hash.put(s, (hash.get(s)+ 1)%2);
- }
- if(getSumOfX("a")%2 == 0 && getSumOfX("b")%2 == 0 && getSumOfX("c")%2 == 0)
- break;
- }
- String res ="";
- for(String s : hash.keySet())
- {
- res += hash.get(s) + " ";
- }
- System.out.println(res.trim());
- }
- public static int getSumOfX(String x)
- {
- int sum = 0;
- for(String s : hash.keySet())
- {
- if(s.indexOf(x) != -1)
- sum += hash.get(s);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement