日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

A. Fraction

發布時間:2023/12/13 综合教程 37 生活家
生活随笔 收集整理的這篇文章主要介紹了 A. Fraction 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

A. Fraction

time limit per test
1 second

memory limit per test
512 megabytes

input
standard input

output
standard output

Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction is called proper iff its numerator is smaller than its denominator (a?<?b) and that the fraction is called irreducible if its numerator and its denominator are coprime (they do not have positive common divisors except 1).

During his free time, Petya thinks about proper irreducible fractions and converts them to decimals using the calculator. One day he mistakenly pressed addition button (?+?) instead of division button (÷) and got sum of numerator and denominator that was equal to n instead of the expected decimal notation.

Petya wanted to restore the original fraction, but soon he realized that it might not be done uniquely. That's why he decided to determine maximum possible proper irreducible fraction such that sum of its numerator and denominator equals n. Help Petya deal with this problem.

Input

In the only line of input there is an integer n (3?≤?n?≤?1000), the sum of numerator and denominator of the fraction.

Output

Output two space-separated positive integers a and b, numerator and denominator of the maximum possible proper irreducible fraction satisfying the given sum.

Examples

Input

3

Output

1 2

Input

4

Output

1 3

Input

12

Output

5 7

 1 #include <iostream>
 2 using namespace std;
 3 int gcd(int a,int b){
 4   return b==0?a:gcd(b,a%b);
 5 }
 6 int main(){
 7   int n;
 8   cin>>n;
 9   if(n%2==0){
10     for(int i=n/2-1,j=n/2+1;i>=1;i--,j++){
11       if(gcd(i,j)==1)
12         {
13           cout<<i<<" "<<j<<endl;
14           break;
15         }
16     }
17   }else{
18     cout<<(n-1)/2<<" "<<(n+1)/2<<endl;
19   }
20   return 0;
21 }

總結

以上是生活随笔為你收集整理的A. Fraction的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。