Universal Cup Judging System

Universal Cup

Límite de tiempo: 2.0 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓
Estadísticas

給定一個正整數 $N$。

請找出滿足 $1 \le a, b < 2^N$ 且符合以下條件的整數對 $(a, b)$ 的數量,並將結果對質數 $998244353$ 取模:

  • 存在一個非退化三角形,其三邊長分別為 $a, b, a \oplus b$。

在此,對於整數 $x, y$,$x \oplus y$ 表示 $x$ 與 $y$ 的位元互斥或(bitwise XOR)。

輸入格式

第一行包含一個整數 $N$。($1 \le N \le 10^{18}$)

輸出格式

輸出滿足條件的整數對 $(a, b)$ 的數量,並對 $998244353$ 取模。

範例

輸入格式 1

2

輸出格式 1

0

輸入格式 2

5

輸出格式 2

390

說明

以第二個範例為例,$(a, b) = (13, 24)$ 滿足條件。因為 $a \oplus b = 13 \oplus 24 = 21$,存在一個邊長為 $13, 24, 21$ 的非退化三角形。

共有 $390$ 對滿足條件的整數對 $(a, b)$。

輸入格式 3

10000

輸出格式 3

851087540

說明

非負整數 $x, y$ 的位元互斥或 $x \oplus y$ 定義如下:

  • 在 $x \oplus y$ 的二進位表示中,第 $2^k$ ($k \ge 0$) 位為 $1$ 當且僅當 $x$ 與 $y$ 的二進位表示中,第 $2^k$ 位恰有一個為 $1$;否則該位為 $0$。

例如,$3 \oplus 5 = 6$(二進位為 $011 \oplus 101 = 110$)。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1536EditorialOpen题解jiangly2026-04-15 16:06:39View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.