3でも5でも7でも割り切れない1000000以下の数はいくつあるか。この問題を動的計画法と算術的解法で解いてみる。 まず動的計画法のコード。(python)。 続いて算術的解法。 算術的解法: 算術的解法を用いると、互いに素な数の集合からの数え上げは包含排除 ...
## Given a set of distinct integers, print the size of a maximal subset of S ## where the sum of any numbers in S' is not evenly divisible by k. # group members of s by their remainders when divided ...
For a given number, find all the numbers smaller than the number. Numbers should be divisible by 3 and also by 5. This one is easy. We took an input number from the user, and then pass it to a ...