zoukankan      html  css  js  c++  java
  • Codeforces Round #430 (Div. 2)

    题目链接:http://codeforces.com/contest/842/problem/A

    题意:给定l,r,x,y,k.问是否存在a (l<=a<=r) 和b (x<=b<=y) 使得 a/b=k (a/b可能为浮点数)。

    思路:暴力枚举即可。

    #define _CRT_SECURE_NO_DEPRECATE
    #include<iostream>
    #include<cstring>
    #include<string>
    #include<algorithm>
    #include<stdio.h>
    #include<queue>
    #include<vector>
    #include<stack>
    #include<map>
    #include<set>
    #include<time.h>
    #include<cmath>
    #include<sstream>
    #include<assert.h>
    using namespace std;
    typedef long long int LL;
    const int inf = 0x3f3f3f3f;
    const LL INF = 0x3f3f3f3f3f3f3f3fLL;
    const int MAXN = 1e5 + 24;
    
    int main(){
    //#ifdef kirito
    //    freopen("in.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
    //#endif
    //    int start = clock();
        int l, r, x, y, k;
        while (~scanf("%d%d%d%d%d",&l,&r,&x,&y,&k)){
            bool flag = false;
            for (int i = l; i <= r; i++){
                int b = i / k;
                if (i%k == 0 && b >= x&&b <= y){
                    flag = true; break;
                }
            }
            printf(flag ? "YES
    " : "NO
    ");
        }
    //#ifdef LOCAL_TIME
    //    cout << "[Finished in " << clock() - start << " ms]" << endl;
    //#endif
        return 0;
    }
  • 相关阅读:
    桂林印象
    快变
    近期的事
    *C#中使用ref和out一点认识!*
    *在框架集页面放置TreeView控件时页面跳转的问题解决*
    *无法找到脚本库的问题*
    *Ajax.Net快速入门*
    *网页过期*
    *Prototype开发笔记*
    *正则表达式*
  • 原文地址:https://www.cnblogs.com/kirito520/p/7452319.html
Copyright © 2011-2022 走看看