其他分享
首页 > 其他分享> > 2019 China Collegiate Programming Contest Qinhuangdao Onsite

2019 China Collegiate Programming Contest Qinhuangdao Onsite

作者:互联网

目录

Contest Info


Practice Link

Solved A B C D E F G H I J K L
5/12 O - - O - O - - - O Ø -

Solutions


A. Angle Beats

题意:
给出\(n\)个点,每次询问再给出一个点,询问\(n\)个点中与当前这个点构成直角三角形的方案数。

D. Decimal

题意:
给出一个\(n\),判断\(\frac{1}{n}\)是否是一个无限循环小数。

思路:
如果\(n\)的质因子分解是\(2^x5^y\)那么不是无限循环

代码:


view code

#include <bits/stdc++.h>
#define debug(...) { printf("#  "); printf(__VA_ARGS__); puts(""); }
#define fi first
#define se second
#define endl "\n" 
using namespace std;
using db = double;
using ll = long long;
using ull = unsigned long long; 
using pII = pair <int, int>;
using pLL = pair <ll, ll>;
constexpr int mod = 1e9 + 7;
template <class T1, class T2> inline void chadd(T1 &x, T2 y) { x += y; while (x >= mod) x -= mod; while (x < 0) x += mod; } 
template <class T1, class T2> inline void chmax(T1 &x, T2 y) { if (x < y) x = y; }
template <class T1, class T2> inline void chmin(T1 &x, T2 y) { if (x > y) x = y; }
inline int rd() { int x; cin >> x; return x; }
template <class T> inline void rd(T &x) { cin >> x; }
template <class T> inline void rd(vector <T> &vec) { for (auto &it : vec) cin >> it; }
inline void pt() { cout << endl; }
template <class T, class... Ts> void pt(const T& arg, const Ts&... args) { cout << arg << " "; pt(args...); }
template <class T> inline void pt(const T &s) { cout << s << "\n"; }
template <class T> inline void pt(const vector <T> &vec) { for (auto &it : vec) cout << it << " "; cout << endl; } 
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll qpow(ll base, ll n) { ll res = 1; while (n) { if (n & 1) res = res * base % mod; base = base * base % mod; n >>= 1; } return res; }
constexpr int N = 1e5 + 10;
int n; 
void run() {
    cin >> n;
    while (n % 2 == 0) n /= 2;
    while (n % 5 == 0) n /= 5;
    if (n == 1) pt("No");
    else pt("Yes");
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cout << fixed << setprecision(20);
    int _T; cin >> _T;
    while (_T--) run();
    return 0;
}

标签:Onsite,pt,cout,Qinhuangdao,Contest,int,void,using,inline
来源: https://www.cnblogs.com/Dup4/p/11718018.html