Codeforces Round #609 (Div. 2) A. Equation

链接:

https://codeforces.com/contest/1269/problem/A

题意:

Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example:

the following numbers are composite: 1024, 4, 6, 9;
the following numbers are not composite: 13, 1, 2, 3, 37.
You are given a positive integer n. Find two composite integers a,b such that a−b=n.

It can be proven that solution always exists.

思路:

奇偶数分别判断

代码:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    if (n%2 == 0)
        cout << n+4 << ' ' << 4 << endl;
    else
        cout << n+9 << ' ' << 9 << endl;

    return 0;
}
上一篇:vscode 常用配置


下一篇:mysql-读写分离