Codeforces Round #430 (Div. 2) - A

 

题目链接: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\n" : "NO\n");
    }
//#ifdef LOCAL_TIME
//    cout << "[Finished in " << clock() - start << " ms]" << endl;
//#endif
    return 0;
}

 

posted @ 2017-08-30 11:42  キリト  阅读(189)  评论(0编辑  收藏  举报