Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) A. Fraction
Posted 早知如此绊人心,何如当初莫相识。
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) A. Fraction相关的知识,希望对你有一定的参考价值。
题意:2个数A,B,A+B==n,并且A<B,问最大的A/B是多少,A与B互质
1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e5+100; 4 typedef long long ll; 5 6 7 int main(){ 8 int n; 9 cin>>n; 10 for(int i=n/2;i>=1;i--){ 11 int y=n-i; 12 if(__gcd(i,y)==1){ 13 cout<<i<<" "<<y<<endl;return 0; 14 } 15 } 16 }
以上是关于Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) A. Fraction的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) D
Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) A
codeforces比赛题解#854 CF Round #433 (Div.2)
Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) C. Planning