ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1091. Tmutarakan Exams

Simple DP
Posted by guilty spark 16 Jul 2021 18:47
DP[i][j][k] = count of sets of length i ending at number j with total gcd of k
initialize with dp[1][n][n] = 1 for every n >= 2 && n <= s
ans is summation of all dp[K][num][g] where g > 1 and num between 2 and s

Edited by author 16.07.2021 18:48

Edited by author 16.07.2021 18:48

Edited by author 16.07.2021 18:48