問題一覧 > 通常問題

No.3557 KCPC or KUPC 2

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 63
作問者 : fluorine / テスター : 👑 みうね TKTYI HoyHoyCharhang jastaway soryuusi0219 yaaya butsurizuki wasab1 tatesoto KumaTachiRen
お気に入りにしたユーザー ProblemId : 13378 / 自分の提出
問題文最終更新日: 2026-08-15 03:08:17
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
KCPC新歓杯2026 (順位表) の他の問題:

Problem Statement

Now that you have become a university student, you have decided to start a part-time job.

There are two candidate employers: KCPC Inc. and KUPC Inc.

At KCPC Inc., the initial daily wage is $A$ yen, and it rises by $C$ yen for every $B$ days worked.

At KUPC Inc., the initial daily wage is $D$ yen, and it rises by $F$ yen for every $E$ days worked.

Here, "the initial daily wage is $x$ yen, and it rises by $z$ yen for every $y$ days worked" strictly means the following.

  • Counting the first day of work as day $1$, the daily wage on day $i$ is $\displaystyle x+z \times \left \lfloor \frac{i-1}{y} \right \rfloor$ yen. ( $\lfloor x \rfloor$ denotes $x$ rounded down to an integer by discarding its fractional part.)

You will choose one of the companies and work there every day from now on.

At which company can you earn $N$ yen sooner?

Print KCPC if it is KCPC Inc., KUPC if it is KUPC Inc., and Same if both take the same number of days.

Input

The input is given from standard input in the following format.

$N$
$A$ $B$ $C$
$D$ $E$ $F$
  • $1\leq N\leq 10^{16}$
  • $1\leq A, B, C, D, E, F\leq 10^6$
  • All input values are integers.

Partial Score

This problem has partial scoring based on subtasks.

SubtaskScoreConstraints
部分点110% (20 pts)$N \le 10^6$
部分点240% (80 pts)$N \le 10^9$
部分点350% (100 pts)追加の制約はない

Output

Print KCPC if the answer is KCPC Inc., KUPC if the answer is KUPC Inc., and Same if both take the same number of days.

Sample

Sample 1
Input
10000
1200 2 100
1500 3 50
Output
KUPC

The daily wages at KCPC Inc., starting from day $1$, are $1200,1200,1300,1300,1400,1400,1500,1500,\dots$ yen, and the total reaches at least $10000$ yen on day $8$.
The daily wages at KUPC Inc., starting from day $1$, are $1500,1500,1500,1550,1550,1550,1600,1600,\dots$ yen, and the total reaches at least $10000$ yen on day $7$.

You can earn $10000$ yen sooner at KUPC Inc.

Sample 2
Input
10000000000000000
1000000 1 1000000
1000000 1 1000000
Output
Same

Sample 3
Input
1000000000
3 1 4
1 5 9
Output
KCPC

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