zoukankan      html  css  js  c++  java
  • 【Codeforces Round #433 (Div. 2) A】Fraction

    【链接】h在这里写链接


    【题意】


    在这里写题意

    【题解】


    枚举分子从高到低就好.
    这样得到的一定是最大的。
    (可以约分没错,但是约分过后和就不是n了,所以不会有错的)

    【错的次数】


    0

    【反思】


    在这了写反思

    【代码】

    /*
    
    */
    #include <cstdio>
    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <vector>
    #include <map>
    #include <queue>
    #include <iomanip>
    #include <set>
    #include <cstdlib>
    #include <cmath>
    #include <bitset>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define pb emplace_back
    #define fi first
    #define se second
    #define ld long double
    #define ms(x,y) memset(x,y,sizeof x)
    #define ri(x) scanf("%d",&x)
    #define rl(x) scanf("%lld",&x)
    #define rs(x) scanf("%s",x)
    #define rf(x) scnaf("%lf",&x)
    #define oi(x) printf("%d",x)
    #define ol(x) printf("%lld",x)
    #define oc putchar(' ')
    #define os(x) printf(x)
    #define all(x) x.begin(),x.end()
    #define Open() freopen("F:\rush.txt","r",stdin)
    #define Close() ios::sync_with_stdio(0)
    #define sz(x) ((int) x.size())
    #define ld long double
    
    typedef pair<int, int> pii;
    typedef pair<LL, LL> pll;
    
    //mt19937 myrand(time(0));
    //int get_rand(int n){return myrand()%n + 1;}
    const int dx[9] = { 0,1,-1,0,0,-1,-1,1,1 };
    const int dy[9] = { 0,0,0,-1,1,-1,1,-1,1 };
    const double pi = acos(-1.0);
    const int N = 110;
    
    int n;
    
    int main() {
    	//Open();
    	//Close();
    	ri(n);
    	rep2(i, n, 1) {
    		int j = n - i;
    		if (i < j && __gcd(i, j) == 1){
                cout << i <<' ' << j << endl;
                break;
    		}
    	}
    	return 0;
    }
    


  • 相关阅读:
    EditorWindow 和MenuItem
    PropertyDrawer 自定义属性绘图
    NGUI3.5系列教程之 一些小功能的实现
    NGUI3.5系列教程之 UILabel
    关于Resources.LoadAssetAtPath
    C#调用Python 脚本语言
    unity项目实现“再按一次退出程序”提示功能
    在Visual Studio 2010 中创建类库(dll)
    Unity 优化
    JAVA package-info文件【转】
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626041.html
Copyright © 2011-2022 走看看