HBC245411特技飞行Exercise In Class题解

冷夕颜 算法基础篇 28 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
In the new semester, TTL and YXH learn two new functions in class: the fifirst function f is defifined as the number of ‘1’ in the binary representation of x, for example, f = 1,f = 2,f = 2; The second function g = f, where ‘ & ’ denotes bitwise AND, and ‘ >> ’ denotes bitwise right shift operation. To test how far they grasp the two functions, their teacher assigns a class exercise. In this exercise, an integer k is given, then both TTL and YXH need to choose an interval respectively, denoted as [l1, r1] and [l2, r2]. After that, the teacher asks them to fifind all pairs such that x ∈ [l1, r1], y ∈ [l2, r2], and x ⊕ y ≤ k, then calculate the sum of g(x|y)!

In the new semester, TTL and YXH learn two new functions in class: the fifirst function f(x) is defifined as the number of ‘1’ in the binary representation of x, for example, f(1) = 1,f(3) = 2,f(5) = 2; The second function g(x) = f(x & (x >> 1)), where ‘ & ’ denotes bitwise AND, and ‘ >> ’ denotes bitwise right shift operation. To test how far they grasp the two functions, their teacher assigns a class exercise. In this exercise, an integer k is given, then both TTL and YXH need to choose an interval respectively, denoted as [l1, r1] and [l2, r2]. After that, the teacher asks them to fifind all pairs (x, y) such that x ∈ [l1, r1], y ∈ [l2, r2], and x ⊕ y ≤ k, then calculate the sum of g(x|y)! , where ‘ ⊕ ’ denotes bitwise XOR, ‘ | ’ denotes bitwise OR, and ‘ ! ’ is the factorial notation. If there is no such pair, the answer is 0. TTL and YXH think the problem is too difficult, so they ask smart you for help. Given the integer k and the two intervals [l1, r1] and [l2, r2], can you help them fifigure out the answer? Since the answer is likely to be very large, you just have to fifigure out the answer modulo 998244353.

HBC245411特技飞行Exercise In Class题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC245411特技飞行Exercise In Class题解