数论。

如果$x$不唯一,假设存在两个解,较大的为${x_1}$,较小的为${x_2}$。

那么,

$\left\{ {\begin{array}{*{20}{c}}
{{x_1}\% {c_i} = {x_2}\% {c_i}}\\
{{x_1}\% k \ne {x_2}\% k}
\end{array}} \right. \Rightarrow \left\{ {\begin{array}{*{20}{c}}
{({x_1} - {x_2})\% {c_i} = 0}\\
{({x_1} - {x_2})\% k \ne 0}
\end{array}} \right.$。

$∵lcm({c_1},{c_2},{c_3},......,{c_n})\% {c_i} = 0$

$∴lcm({c_1},{c_2},{c_3},......,{c_n})\% ({x_1} - {x_2}) = 0$

$∵({x_1} - {x_2})\% k \ne 0$

$∴lcm({c_1},{c_2},{c_3},......,{c_n})\% k \ne 0$

也就是说:如果解不唯一,那么$lcm({c_1},{c_2},{c_3},......,{c_n})\% k \ne 0$。

换句话说就是:如果解唯一,那么$lcm({c_1},{c_2},{c_3},......,{c_n})\% k = 0$。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar(); x = ;while(!isdigit(c)) c = getchar();
while(isdigit(c)) { x = x * + c - ''; c = getchar(); }
} LL gcd(LL a,LL b)
{
if(b==) return a;
return gcd(b,a%b);
} LL lcm(LL a,LL b)
{
return a*b/gcd(a,b);
} int n;
LL ans=,k; int main()
{
scanf("%d%lld",&n,&k);
for(int i=;i<=n;i++)
{
LL x; scanf("%lld",&x);
ans=lcm(ans,x)%k;
}
if(ans) printf("No\n");
else printf("Yes\n"); return ;
}

CodeForces 687B Remainders Game的更多相关文章

  1. Codeforces 687B. Remainders Game[剩余]

    B. Remainders Game time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  2. codeforces 687B - Remainders Game 数学相关(互质中国剩余定理)

    题意:给你x%ci=bi(x未知),是否能确定x%k的值(k已知) ——数学相关知识: 首先:我们知道一些事情,对于k,假设有ci%k==0,那么一定能确定x%k的值,比如k=5和ci=20,知道x% ...

  3. CodeForces 687B Remainders Game(数学,最小公倍数)

    题意:给定 n 个数,一个数 k,然后你知道一个数 x 取模这个 n 个的是几,最后问你取模 k,是几. 析:首先题意就看了好久,其实并不难,我们只要能从 n 个数的最小公倍数是 k的倍数即可,想想为 ...

  4. 【16.56%】【codeforces 687B】Remainders Game

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. Codeforces Educational Codeforces Round 5 E. Sum of Remainders 数学

    E. Sum of Remainders 题目连接: http://www.codeforces.com/contest/616/problem/E Description The only line ...

  6. Codeforces Round #360 (Div. 2) D. Remainders Game 数学

    D. Remainders Game 题目连接: http://www.codeforces.com/contest/688/problem/D Description Today Pari and ...

  7. codeforces 360 D - Remainders Game

    D - Remainders Game Description Today Pari and Arya are playing a game called Remainders. Pari choos ...

  8. codeforces 616E Sum of Remainders (数论,找规律)

    E. Sum of Remainders time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  9. Educational Codeforces Round 5 E. Sum of Remainders (思维题)

    题目链接:http://codeforces.com/problemset/problem/616/E 题意很简单就不说了. 因为n % x = n - n / x * x 所以答案就等于 n * m ...

随机推荐

  1. pydev去掉右边的预览栏minimap

    eclipse pydev: preferences > PyDev > Editor > Overview Ruler Minimap

  2. Load ContextCLR 探测

    目录 背景Load ContextCLR 探测过程弱签名程序集的探测过程强签名程序集的探测过程Default ContextLoad-From ContextNo ContextRelfection- ...

  3. TOGAF架构能力框架之架构委员会和架构合规性

    TOGAF架构能力框架之架构委员会和架构合规性 3. 架构委员会 正如前面所说,一个用来对架构治理策略的实现进行监督的跨组织的架构委员会是架构治理策略成功的主要要素之一.架构委员会应该能够代表所有主要 ...

  4. TPL相关

    C#中的Timer System.Windows.Forms.TimerSystem.Threading.Timer System.Timers.Timer 1.System.Windows.Form ...

  5. JPA 批注参考

    body, p, th, td, li, ul, ol, h1, h2, h3, h4, h5, h6, pre { font-family: simsun; line-height: 1.4; } ...

  6. windows下配置PHP+Nginx+MySQL完整流程(转)

    对于在windows上的php+nginx的配置可能好多同学一次根本都配不正确,于我也是如此,为此我将我成功配置的过程细致的总结如下,希望能帮助搞PHP研究的同学 1.资源准备 MySQL:这个链接不 ...

  7. WP8开发札记(二)让程序支持锁屏运行

    我们都知道WP8是采用墓碑机制来管理应用程序的. 当我们把手机锁屏了,默认情况下,App就触发了deactivated 事件,准备被墓碑化了. 但是,有些时间我们不想让程序就此终止运行.(比如说,你开 ...

  8. Composite C1是一个.Net平台上开源专业的CMS开源项目

    CompositeC1 4 发布 Composite C1是一个.Net平台上开源专业的CMS开源项目,很多的功能用户界面,面向任务的支持与各种工具协作.当编辑内容时在用户端体验很友好.编辑器与开发者 ...

  9. Lucene简介(理论篇)

    Lucene 是一个软件程序的库或者说是一个工具套件,而不是一个完全的具有搜索特性的应用程序.它关注于自己的文本检索和搜索功能,提供API来完成商业中所涉及到的搜索功能.在搜索功能中,Lucene的功 ...

  10. java链接mysql数据库

    package com.DateSystem; import java.sql.Connection; import java.sql.DriverManager; import java.sql.S ...