Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Mar 17, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/33614

🧭 풀이 시간

15분

👀 체감 난이도

✏️ 문제 설명

세 양의 정수 p, q, r이 주어진다.
a <= p, b <= q, c <= r을 만족하는 (a,b,c)에 대해, $a \oplus b \oplus c = a^{b^c}$가 되는 경우의 수를 구해보자.
$\oplus$는 xor 연산을 의미한다.

🔍 풀이 방법

[사용한 알고리즘]

  • ?

  1. a = 1이면, $1 \oplus b \oplus c = 1$인 쌍의 수를 찾으면 된다. -> $b \oplus c = 0$이라서 $b = c$이다.
    결국, 경우의 수는 $\min(q,r)$이다.
  2. a > 1이면?
    2-1. b = 1이면, $a \oplus 1 \oplus c = a$가 된다. -> $c = 1$이다. 경우의 수는 p-1이 된다.
    2-2. b > 1이면? $a \oplus b \oplus c = a^{b^c}$인데, $a \oplus b \oplus c &lt;= 2\max(a,b,c) &lt; a^{b^c}$이다. 경우의 수는 0이다.

종합하면, 답은 $\min(q,r) + p-1$이다.

⏳ 회고

진짜 신기한 문제다

@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Mar 17, 2025
@ShinHeeEul ShinHeeEul merged commit 80ff2f0 into main Mar 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants