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;
    }
    
  • 相关阅读:
    算法-转
    单页 SEO-转
    浅谈MVVM设计模式
    iOS-UIView动画
    iOS 核心动画(下)
    iOS开发-核心动画(Core Animation)
    iOS-CALayer的介绍
    SVN Xcode不能提交.a文件
    iOS 毛玻璃效果
    Quartz2D学习总结
  • 原文地址:https://www.cnblogs.com/AWCXV/p/8051366.html
Copyright © 2011-2022 走看看