Volume 07

301. Nim

显然只有当的时候才有, 直接枚举就好了. 似乎答案就是.

302. Strong Achilles Numbers

303. Multiples with small digits

可以直接用bfs暴力算出答案, 有点大, 已经超过long long了, 但是可以用__int128存下, 还是可以暴力的.

304. Primonacci

找出以内的素数, 然后用区间筛法求出以内的素数, 然后矩阵乘法求fibonacci数就好了.

305. Reflexive Position

306. Paper-strip Game

307. Chip Defects

用容斥原理做, 求出小于的概率, 然后减掉即可. 这部分概率就是满足, 表示有个chip有个defect, 个chip有个defect. 对于一组概率是. 取对数计算即可.

308. An amazing Prime-generating Automaton

309. Integer Ladders

310. Nim Square

311. Biclinic Integral Quadrilaterals

312. Cyclic paths on Sierpiński graphs

313. Sliding game

可以找出如下的公式

于是枚举素数, 分两种情况计算即可.

314. The Mouse on the Moon

315. Digital root clocks

按照题意直接模拟就好了.

316. Numbers in decimal expansions

317. Firecracker

一个物理题. 考虑两种最极端的情况:

  1. 垂直往上, 这个我们可以算出一个最高点.
  2. 水平射出, 我们可以算出一个最远点.

显然, 这个东西的切面就是连接这两个的抛物线. 然后这个抛物线旋转一周就的到了答案. 公式是:

318. 2011 nines

319. Bounded Sequences

320. Factorials divisible by a huge integer

321. Swapping Counters

可以算出, 于是令, 化简一下得到 (是和有关的整数). 解一解可以得到如下递推式:

初始解有.

322. Binomial coefficients divisible by 10

323. Bitwise-OR operations on random integers

很容易知道答案是. 取个上界精度就够了.

324. Building a tower

325. Stone Game II

326. Modulo Summations

327. Rooms of Doom

329. Prime Frog

可以很容易列出概率转移方程, 随便计算下就好了.

330. Euler's Number

331. Cross flips

332. Spherical triangles

333. Special partitions

334. Spilling the beans

335. Gathering the beans

336. Maximix Arrangements

暴力枚举就好了.

337. Totient Stairstep Sequences

表示以结尾的方案数, . 令的前缀和, 那么. 前者用树状数组求和就好了.

338. Cutting Rectangular Grid Paper

339. Peredur fab Efrawg

340. Crazy Function

把那个式子化简化简可以得到. 于是就是一个等差数列求和.

341. Golomb's self-describing sequence

342. The totient of a square is a cube

343. Fractional Sequences

344. Silver dollar game

345. Matrix Sum

表示前行, 选了哪些列已经被选过了的最优值. 枚举下一行选哪个列即可.

346. Strong Repunits

枚举, 那么显然这个数是. 于是只要把这些数存进一个map, 然后枚举哪些数出现了2次即可. 当然对于base ,显然也是repunit, 这个需要判断下map中只出现一个数.

347. Largest integer divisible by two primes

对于每个数, 可以质因数分解, 然后如果他只有两个质因数, 那么更新下的答案. 最后求个和就好了.

348. Sum of a square and a cube

枚举, 使得小于某个阈值(我取了), 然后暴力算下即可.

349. Langton's ant

350. Constraining the least greatest and the greatest least