zoukankan      html  css  js  c++  java
  • 【Codeforces Round #451 (Div. 2) B】Proper Nutrition

    【链接】 我是链接,点我呀:)
    【题意】

    在这里输入题意

    【题解】

    可以直接一层循环枚举。 也可以像我这样用一个数组来存y*b有哪些。 当然。感觉这样做写麻烦了。。

    【代码】

    /*
      	1.Shoud it use long long ?
      	2.Have you ever test several sample(at least therr) yourself?
      	3.Can you promise that the solution is right? At least,the main ideal
      	4.use the puts("") or putchar() or printf and such things?
      	5.init the used array or any value?
      	6.use error MAX_VALUE?
      	7.use scanf instead of cin/cout?
      	8.whatch out the detail input require
    */
    #include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    
    long long n,a,b;
    bool bo[(int)1e7+100];
    
    int main(){
    	#ifdef LOCAL_DEFINE
    	    freopen("rush_in.txt", "r", stdin);
    	#endif
    	ios::sync_with_stdio(0),cin.tie(0);
        cin >> n >> a >> b;
        for (ll y = 0;;y++){
            if (y*b>1e7) break;
            bo[y*b] = true;
        }
        for (ll x = 0;;x++){
            ll temp = n-x*a;
            if (temp<0) break;
            if (bo[temp]){
                cout <<"YES"<<endl;
                cout << x <<' '<<temp/b<<endl;
                return 0;
            }
        }
        cout <<"NO"<<endl;
    	return 0;
    }
    
  • 相关阅读:
    HDU 1711
    HDU 4135
    HDU 4462
    HDU 1969
    flask的nocache防止js不刷新
    python2.x里unicode错误问题
    使用SwingWork反而阻塞SwingUI
    利用JProfile 7分析内存OOM
    编译android的一些坑
    java jmenu的替代方案
  • 原文地址:https://www.cnblogs.com/AWCXV/p/8051366.html
Copyright © 2011-2022 走看看