問題一覧 > 通常問題

No.1274 Fun Lattice Points

レベル : / AI推定難易度 : 1500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-6}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 35
作問者 : PCTprobability / テスター : hotman78
お気に入りにしたユーザー ProblemId : 5273 / 自分の提出
問題文最終更新日: 2020-10-31 00:34:52
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 272 (Weird math contest) (順位表) の他の問題:

Problem Statement

There is a $2$-dimensional coordinate plane, and a piece is placed at $(1,1)$. On this coordinate plane, $ \frac{1}{(x+y)^{(x+y)}}$ is written on each point whose $x,y$ coordinates are both positive, and $0$ is written on all other lattice points.

You are given integers $A,B$. When the piece is currently at lattice point $(p,q)$, the points it can move to are the following $8$ locations:

$(p+A,q+B),(p+A,q-B),(p-A,q+B),(p-A,q-B),(p+B,q+A),(p+B,q-A),(p-B,q+A),(p-B,q-A)$.

Find the sum of the numbers written on the points that can be reached with $0$ or more moves. It can be proved that this value is finite. 21:44 Since $(p-A,q+B)$ appeared $2$ times, one of them was corrected to $(p-A,q-B)$.

Input

$A$ $B$

  • All inputs are integers.
  • $-10^{18} \le A,B \le 10^{18}$

Output

Output the sum of the numbers written on the reachable points. Your answer is considered correct if the smaller of the relative error and the absolute error is at most $10^{-6}$.

Sample

Sample 1
Input
3 -6
Output
0.250640178827954352087144934691

In this case, the piece can move $3$ times the distance of a chess knight. That is, when at $(a,b)$, it can move to $(a+3,b+6),(a+3,b-6),(a-3,b+6),(a-3,b-6),(a+6,b+3),(a+6,b-3),(a-6,b+3),(a-6,b-3)$.

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