其他分享
首页 > 其他分享> > Codeforces Round #609 (Div. 2) A. Equation

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;
}

标签:composite,positive,Equation,609,int,numbers,following,integer,Div
来源: https://www.cnblogs.com/YDDDD/p/12082571.html