問題一覧 > 通常問題

No.420 mod2 Recurrence Relation

レベル : / AI推定難易度 : 925 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 278
作問者 : kzyKT / テスター : はむこ
お気に入りにしたユーザー ProblemId : 491 / 自分の提出
問題文最終更新日: 2026-06-25 15:04:08
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 148 (順位表) の他の問題:

Problem Statement

The following recurrence relation is given.
$f(0) \ = \ 0$
$f(n) \ = \ f(n/2) \ + \ (n \ mod \ 2)$
$(n$ is an integer$、n/2$ is rounded down to an integer$)$

Among $0 \le n \le 2^{31}-1 \ (2147483647)$,
find the number of $n$ such that $f(n) \ = \ x \ $ and the sum of such $n$.

Input

$x$

An integer $x$ is given on $1$ line.
$0 \le x \le 10^9$

Output

Output the number of $n$ such that $f(n)=x$ and the sum of such $n$, separated by a space.

Sample

Sample 1
Input
5
Output
169911 58851789346035

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。