CF1594F. Ideal Farm 2400 —— math ?

题目链接

// Decline is inevitable,
// Romance will last forever.
#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <vector>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define endl '\n'
//#define int long long
using namespace std;
const int P = 1e9 + 7;
const int maxn = 5e3 + 10;
const int maxm = 2e6 + 10;
const int INF = 0x3f3f3f3f;
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll s, n, k;
void solve() {
    cin >> s >> n >> k;
    if(s == k) {
        cout << "YES\n";
        return;
    }
    ll p = s / k;
    ll r = s % k;
    ll cnt = 2 * ceil((p - 1)/2.0) + ceil((1+p)/2.0) * (r - 1) + ceil(p/2.0) * (k - r - 1);
    if(cnt >= n -1)
        cout << "NO\n";
    else cout << "YES\n";
}
signed main() {
//    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int T; cin >> T;while(T--)
    solve();
    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_59273843/article/details/121022977