Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.hacker.earth;
- import java.util.Arrays;
- import java.util.Scanner;
- import java.util.stream.Collectors;
- public class RoyAndBulbs {
- public static void main(String args[]) {
- // Scanner
- Scanner s = new Scanner(System.in);
- String[] data = s.nextLine().split(" ");
- int T = Integer.valueOf(data[0]);
- int R = Integer.valueOf(data[1]);
- int G = Integer.valueOf(data[2]);
- int B = Integer.valueOf(data[3]);
- int[] output = new int[8];
- for (int i = 0; i < T; i++) {
- int red = 0;
- if ((i / R) % 2 == 1) {
- red = 1;
- }
- int blue = 0;
- if ((i / B) % 2 == 1) {
- blue = 1;
- }
- int green = 0;
- if ((i / G) % 2 == 1) {
- green = 1;
- }
- if (red == 1 && green == 0 && blue == 0) {
- output[0]++;
- }
- if (red == 0 && green == 1 && blue == 0) {
- output[1]++;
- }
- if (red == 0 && green == 0 && blue == 1) {
- output[2]++;
- }
- if (red == 1 && green == 1 && blue == 0) {
- output[3]++;
- }
- if (red == 0 && green == 1 && blue == 1) {
- output[4]++;
- }
- if (red == 1 && green == 0 && blue == 1) {
- output[5]++;
- }
- if (red == 1 && green == 1 && blue == 1) {
- output[6]++;
- }
- if (red == 0 && green == 0 && blue == 0) {
- output[7]++;
- }
- }
- System.out.println(Arrays.stream(output).mapToObj(String::valueOf).collect(Collectors.joining(" ")));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement