1. 程式人生 > >牛客小白月賽9 論如何出一道水題

牛客小白月賽9 論如何出一道水題

一行 ret mes include pre pro name its 題目

鏈接:https://ac.nowcoder.com/acm/problem/19425
來源:牛客網

題目描述

給定 n,求一對整數 (i,j),在滿足 1 ≤ i ≤ j ≤ n 且 gcd(i,j)=1gcd(i,j)=1 的前提下,要求最大化 i+j 的值

輸入描述:

第一行一個整數 n

輸出描述:

一行一個整數表示答案
示例1

輸入

復制
2

輸出

復制
3

備註:

數據範圍
1 ≤ n ≤ 10
18
#include<bits/stdc++.h>
using
namespace std; typedef long long LL;LL n; int main(){ while(cin>>n){ if(n==1)cout<<2<<endl; else cout<<n+n-1<<endl; } return 0; }

牛客小白月賽9 論如何出一道水題