首页 > 其他分享 >Nebius Welcome Round (Div. 1 + Div. 2) C. Pull Your Luck

Nebius Welcome Round (Div. 1 + Div. 2) C. Pull Your Luck

时间:2023-03-15 18:33:05浏览次数:56  
标签:Case Pull int Welcome Div include 2n

link

Code

// #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <cctype>
#include <list>
#include <bitset>
#define dbg(x) cout << #x << " = " << x << "\n"
using namespace std;
#define cf int _o_o_;cin>>_o_o_;for (int Case = 1; Case <= _o_o_;Case++)
#define SZ(x) (int)(x.size())
void tmain();
int main() {tmain();return 0;}
// ios::sync_with_stdio(false), cin.tie(nullptr);
 
using ll = long long;
const int maxn = 15;

void solve();
inline void tmain() {
    int t;
    cin >> t;
    while (t -- ) {
        solve();
    }
}

inline void solve() {
    int n,x,p;
    cin >> n >> x >> p;
    // 因为(2n + 1) * 2n / 2 = (2n + 1) * n.(2n+1)*n是n的倍数,
    int mx = min(n * 2, p); // 每2*n次就会循环,所以最大就是2*n。
    bool ans = 0;
    for (int i = 1;i <= mx;i++) {
        ll t = 1ll * i * (i + 1) / 2;
        if ((t + x)%n == 0) {
            ans = 1;
            break;
        }
    }
    cout << (ans ? "Yes\n" : "No\n");
}

标签:Case,Pull,int,Welcome,Div,include,2n
From: https://www.cnblogs.com/FanWQ/p/17219560.html

相关文章

  • jQuery取某个div下所有被选中的checkbox
    jQuery取某个div下所有被选中的checkbox_weixin_36975992的博客-CSDN博客varcategoryCheckedInfo=$("#selectCaregoryinput:checked:checked");if(categoryChecked......
  • Codeforces Round 855 (Div. 3)
    之前立下了一个flag,每个有空的下午做一套CF来增长智商。题目地址G.Symmetree问题的本质如何快速比对两个子树是否相同。考虑树hash。这里采用的是主流的AHU算法(安徽......
  • Codeforces Round 857 (Div. 2) A. Likes
    linkCode//#include<bits/stdc++.h>#include<iostream>#include<cstring>#include<algorithm>#include<vector>#include<queue>#include<cmath>#include......
  • Nebius Welcome Round (Div. 1 + Div. 2) B. Vaccination
    linkCode//#include<bits/stdc++.h>#include<iostream>#include<cstring>#include<algorithm>#include<vector>#include<queue>#include<cmath>#include......
  • C. Pull Your Luck
    C.PullYourLuckWhileJamesisgoneonbusiness,VespertakeshertimeandexploreswhatthelegendaryCasinoRoyalehastooffertopeoplewhoarefondofc......
  • 使用js的html2canvas截图div并下载
    暂未完赛,请继续加油吧-测试截图```functiongetScreenShot(){html2canvas(document.querySelector("#canvas")).then(canvas=>{//docume......
  • Educational Codeforces Round 105 (Rated for Div
    EducationalCodeforcesRound105(RatedforDiv.2)ABCString给定一个字符串只有A、B和C构成。要求替换A、B、C为')'和'(',并且相同字母替换的是一样的,使得字符串变......
  • Codeforces Round 713 (Div
    CodeforcesRound713(Div.3)A-BPalindrome给定字符串只含有\('?'\'0'\'1'\),给定字符串中1的个数\(a\)和0的个数\(b\),你需要将?替换成0或1,使得该字符串变成回文......
  • Codeforces Round 857 (Div. 2)
    比赛地址做到F心态崩了,自然不会去做G.F考虑最终路径一定是这样的1到x节点在x处攒够路费再到n.后者可以通过从n跑dij来求最短路。考虑前者需要求从1~x的最小代价。......
  • A. K-divisible Sum
    A.K-divisibleSum思路\[ans=\left\lceil\frac{kx}{n}\right\rceil\]\[x=x_{min}\ge\left\lceil\frac{n}{k}\right\rceil\]代码点击查看代码#inc......