問題一覧 > 通常問題

No.544 Delete 7

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 323
作問者 : くれちー / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1485 / 自分の提出
問題文最終更新日: 2026-06-26 06:06:19
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 169 (順位表) の他の問題:

Problem Statement

Y-kun, having failed in love, is scheming to make people unhappy by erasing $7$ from the integers.

You are given a non-negative integer $N$ that contains $7$ in at least one of its digits.
Find integers $A,B$ such that $A+B=N$ and neither of them contains $7$ in any digit.
If there are multiple solutions, you may output any of them.

Input

$N$

A non-negative integer $N$ is given.

  • $0 \le N \le 10^9$
  • At least one digit of $N$ is $7$

Output

$A$ $B$

Output integers $A,B$ satisfying the conditions of the problem, separated by a space.
If no solution exists, output $-1$.
Print a newline at the end.

  • $-10^9 \le A \le 10^9$
  • $-10^9 \le B \le 10^9$

Sample

Sample 1
Input
7
Output
3 4

We have $3+4=7$. Other solutions also exist.

Sample 2
Input
17
Output
20 -3

Negative numbers may also be used.

Sample 3
Input
77777
Output
-22223 100000

There may be multiple digits equal to $7$.

Sample 4
Input
123456789
Output
12345689 111111100

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