Competitive Programming Solutions

GitHub
back to dashboard

B. Palindrome, Twelve and Two Terms

Codeforces - Codeforces Round 1102 (Div. 2) · limit: 1.5s · memory: 256MB · view on codeforces

input

6
1
10
310
12
1000000000
6111111111111111

output

1 0
-1
262 48
0 12
889989988 110010012
111111111111111 6000000000000000
Main.java
static void solve() {

        long n = in.nextLong();
        long rem = n % 12;
        if (rem != 10) {
            long a = rem;
            long b = n - a;
            out.println(a + " " + b);
        } else {
            if (n < 22) {
                out.println(-1);
            } else {
                long a = 22;
                long b = n - a;
                out.println(a + " " + b);
            }
        }

    }