AtCoder ABC 010 A&B&C AtCoder - 010
	private void solveA() {
		out.println(next() + "pp");
	}
――I tried to branch at first, but when I thought about it, it was easier to read if I branched at the remainder of 6, which is the least common multiple of 2 and 3. --The if statement that is commented out is also AC
	private void solveB() {
		int n = nextInt();
		int[] wk = IntStream.range(0, n).map(i -> nextInt()).toArray();
		int res = Arrays.stream(wk).reduce(0, (sum, i) -> {
			switch (i % 6) {
			case 1:
				return sum;
			case 2:
				return ++sum;
			case 3:
				return sum;
			case 4:
				return ++sum;
			case 5:
				return sum += 2;
			case 0:
				return sum += 3;
			}
			//			if (i % 2 == 1) {
			//				switch (i % 3) {
			//				case 0:
			//				case 1:
			//					return sum;
			//				case 2:
			//					return sum += 2;
			//				}
			//
			//			} else {
			//				switch (i % 3) {
			//				case 0:
			//					return sum += 3;
			//				case 1:
			//				case 2:
			//					return ++sum;
			//				}
			//			}
			return sum;
		});
		out.println(res);
	}
--I saw the three-square theorem for the first time in a long time ――If you look at the solution after thinking that it will pass even if you push it hard, you can solve it with the ellipse theorem. .. .. I do not understand. .. ..
	private void solveC() {
		int sX = nextInt();
		int sY = nextInt();
		int gX = nextInt();
		int gY = nextInt();
		int t = nextInt();
		int v = nextInt();
		int n = nextInt();
		for (int i = 0; i < n; i++) {
			int tmpX = nextInt();
			int tmpY = nextInt();
			double total = (Math.hypot(Math.abs(tmpX - sX), Math.abs(tmpY - sY))
					+ Math.hypot(Math.abs(tmpX - gX), Math.abs(tmpY - gY)));
			if (total <= t * v) {
				out.println("YES");
				return;
			}
		}
		out.println("NO");
	}
        Recommended Posts