問題一覧 > 通常問題

No.2266 Fractions (hard)

レベル : / AI推定難易度 : 2500 / 実行時間制限 : 1ケース 6.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 8
作問者 : とりゐ / テスター : sotanishy
お気に入りにしたユーザー ProblemId : 9488 / 自分の提出
問題文最終更新日: 2023-04-08 12:41:13
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

Problem Statement

This is a version of Fractions with stricter constraints.

Aoba wrote on a blackboard all irreducible fractions whose numerator and denominator are both positive integers not exceeding $N$. Find the $K$-th smallest of the fractions written on the blackboard.

However, if fewer than $K$ irreducible fractions are written on the blackboard, output -1.

Input

$N$ $K$

  • $1\leq N\leq 10^8$
  • $1\leq K\leq N^2$
  • All inputs are integers.

Output

If fewer than $K$ fractions are written on the blackboard, output -1. Otherwise, output the desired fraction in the format (分子)/(分母), that is, (numerator)/(denominator).

Sample

Sample 1
Input
200000 21871053595
Output
2023/407
Sample 2
Input
100000000 100000000000000
Output
2922326/88828059
Sample 3
Input
100000000 6079271032731815
Output
100000000/1

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