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 ninstead 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
题意:a/b 有gcd(a,b)==1 a<b 现在已知a+b=n,我们求最大的a,b
解法:暴力
 #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int b,a;
cin>>n;
for(int i=;i<=n;i++){
for(int j=i+;j<=n;j++){
if(i+j==n&&__gcd(i,j)==){
a=i;
b=j;
}
}
}
cout<<a<<" "<<b<<endl;
return ;
}

最新文章

  1. JS date常用代码积累
  2. java线程内存模型,线程、工作内存、主内存
  3. Jmeter在linux上运行(命令行运行Jmeter)
  4. Qt消息机制和事件(一)
  5. CentOS学习笔记&mdash;软件管理程序RPM、YUM
  6. sqlite使用小结
  7. Python下调用Linux的Shell命令
  8. nginx+apache+php+mysql服务器集群搭建
  9. Java中的break与continue区别
  10. 浅谈C51内存优化
  11. 关于Set Nocount ON的性能 |c#调用存储过程的返回值总是-1
  12. 将Datagridview中的数据导出至Excel中
  13. 切割模型固定写死了切平面方程是y=0.1
  14. window.jQuery || document...
  15. java.net.UnknownHostException: www.terracotta.org
  16. linux 压缩命令
  17. How to Change MAC Address on Ubuntu
  18. SpringMVC中的 JSR 303 数据校验框架说明
  19. nginx 限流配置
  20. 如何看待阿里 AI 每秒制作 8000 张海报?

热门文章

  1. cmake编译后vs编译(build Solution)报错的解决办法
  2. 农业公司flash动画模板
  3. (转)C/C++——auto,static,register,extern用法
  4. poj 3415 Common Substrings —— 后缀数组+单调栈
  5. 普通项目转为maven项目及相关操作说明
  6. requests.session保持会话
  7. jquery/原生js/css3 实现瀑布流以及下拉底部加载
  8. 如何增加新的PointT类型
  9. Uncommon Words from Two Sentences
  10. day1 java基础回顾-Junit单元测试