#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
//#include<vector>
//#include<stack>
#include<map>
#define R(a,b,c) for(register int (a)=(b);(a)<=(c);++(a))
#define nR(a,b,c) for(register int (a)=(b);(a)>=(c);--(a))
#define Ii inline int
#define Iv inline void
#define Il inline long long
#define Ib inline bool
#define INF 0x7ffffff
#define re register
#define ll long long
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Cmin(a,b) ((a)=(a)<(b)?(a):(b))
#define Cmax(a,b) ((a)=(a)>(b)?(a):(b))
#define Fill(a,b) memset((a),(b),sizeof((a)))
#define D_e_Line printf("\n-------------\n");
#define D_e(x) printf("\n______%d_______\n",x)
#define Pause() system("pause")
using namespace std;
const int N=;
Il read(){
ll s=,f=;char c;
for(c=getchar();c>''||c<'';c=getchar())if(c=='-')f=-;
while(c>=''&&c<='')s=s*+(c^''),c=getchar();
return s*f;
}
template<class Tp>Iv print(Tp x){
if(x<)putchar('-'),x=-x;
if(x>)print(x/);
putchar(x%^'');
}
ll x,y,d,a,b,c;
Iv Exgcd(ll a,ll b,ll &x,ll &y,ll &d){
if(!b)
x=,y=,d=a;
else
Exgcd(b,a%b,y,x,d),y-=x*a/b;
}
#define ON_JUD
int main(){
#ifdef ON_JUD
freopen("exgcd.in","r",stdin),freopen("exgcd.out","w",stdout);
#endif
int T=read();
while(T--){
a=read(),b=read(),c=read(),
Exgcd(a,b,x,y,d);
b/=d;
if(c%d!=){
printf("no\n");continue;
}
int ans=(x*c/d%b+b)%b;
if(ans==)ans+=b;
printf("%d\n",ans);
}
return ;
}
/*
9
7 9 6
1 2 1
2 6 5
2 3 2
4 5 4
2 3 2
1 5 2
4 5 3
2 4 2 6
1
no
1
1
1
2
2
1
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
//#include<vector>
#include<stack>
//#include<map>
#define R(a,b,c) for(register int (a)=(b);(a)<=(c);++(a))
#define nR(a,b,c) for(register int (a)=(b);(a)>=(c);--(a))
#define Ii inline int
#define Iv inline void
#define Il inline long long
#define Ib inline bool
#define INF 0x7ffffff
#define re register
#define ll long long
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Cmin(a,b) ((a)=(a)<(b)?(a):(b))
#define Cmax(a,b) ((a)=(a)>(b)?(a):(b))
#define Fill(a,b) memset((a),(b),sizeof((a)))
#define D_e_Line printf("\n-------------\n");
#define D_e(x) printf("\n______%d_______\n",x)
#define Pause system("pause")
using namespace std;
const int N=;
Ii read(){
int s=,f=;char c;
for(c=getchar();c>''||c<'';c=getchar())if(c=='-')f=-;
while(c>=''&&c<='')s=s*+(c^''),c=getchar();
return s*f;
}
template<class Tp>Iv print(Tp x){
if(x<)putchar('-'),x=-x;
if(x>)print(x/);
putchar(x%^'');
}
int n,m,a[];ll ans;
Ii gcd(int a,int b){
while(b^=a^=b^=a%=b);return a;
//return !b?a:gcd(b,a%b);
}
Iv dfs(int x,int cnt,int tot){
if(cnt&)ans+=m/tot;
else ans-=m/tot;
R(i,x+,n)
dfs(i,cnt+,tot*a[i]/gcd(tot,a[i]));
}
#define ON_JUD
int main(){
#ifdef ON_JUD
freopen("not.in","r",stdin),freopen("not.out","w",stdout);
#endif
n=read(),m=read();
R(i,,n)
a[i]=read();
R(i,,n)
dfs(i,,a[i]);
print(m-ans);
return ;
}
/*
3 20
2 3 5
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
//#include<vector>
//#include<stack>
#include<map>
#define R(a,b,c) for(register int (a)=(b);(a)<=(c);++(a))
#define nR(a,b,c) for(register int (a)=(b);(a)>=(c);--(a))
#define Ii inline int
#define Iv inline void
#define Il inline long long
#define Ib inline bool
#define INF 0x7ffffff
#define re register
#define ll long long
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Cmin(a,b) ((a)=(a)<(b)?(a):(b))
#define Cmax(a,b) ((a)=(a)>(b)?(a):(b))
#define Fill(a,b) memset((a),(b),sizeof((a)))
#define D_e_Line printf("\n-------------\n");
#define D_e(x) printf("\n______%d_______\n",x)
#define Pause system("pause")
using namespace std;
const int N=;
Il read(){
ll s=,f=;char c;
for(c=getchar();c>''||c<'';c=getchar())if(c=='-')f=-;
while(c>=''&&c<='')s=s*+(c^''),c=getchar();
return s*f;
}
template<class Tp>Iv print(Tp x){
if(x<)putchar('-'),x=-x;
if(x>)print(x/);
putchar(x%^'');
}
Il Pow(ll a,ll b,ll mod){
a%=mod,b%=mod;
ll s=;
while(b){
if(b&)s=s*a%mod;
a=a*a%mod,b>>=;
}
return s;
}
Il G(ll x,ll mod){
ll sum=;
R(i,,INF)
if(x%i==){
sum+=i,
x/=i;
if(x==)
return sum;
}
}
Il F(ll x,ll mod){
return Pow(,Pow(,G(x,mod),mod),mod)%mod;
}
#define ON_JUD
int main(){
#ifdef ON_JUD
freopen("func.in","r",stdin),freopen("func.out","w",stdout);
#endif
ll l=read(),r=read(),mod=read();
if(l==r){
printf("0\n");return ;
}
ll ans=F(l,mod);
R(i,l+,r)
ans^=F(i,mod);
print(ans);
return ;
}

CDQZ Day7的更多相关文章

  1. CDQZ集训DAY7 日记

    并没有考试然而心情比考试还糟糕…… 上午讲的基本就听不懂,讲课人迷之停顿.根本让人跟不上趟,声音好奇怪的说……好不容易讲到反演,Hzoi集体上线,等待装逼时刻的到来.然而,讲课人再次迷之停顿,讲一个p ...

  2. CDQZ多校集训记

    20171218 DAY0 初相逢 今天的阳光很好,确实好极了.下午开始时,mercer说门外站了一堆人,我看都不用看就知道是衡水的.衡水人,怎么说呢,觉得还是挺不一样的.不知道像凡哥和超哥这种奇异的 ...

  3. 记一周cdqz训练

    #include <cstdio> using namespace std; int main(){ puts("转载请注明出处:http://www.cnblogs.com/w ...

  4. day7

    本节作业: 选课系统 角色:学校.学员.课程.讲师要求:1. 创建北京.上海 2 所学校2. 创建linux , python , go 3个课程 , linux\py 在北京开, go 在上海开3. ...

  5. Python之路,Day7 - Python基础7 面向对象

    本节内容:   面向对象编程介绍 为什么要用面向对象进行开发? 面向对象的特性:封装.继承.多态 类.方法.     引子 你现在是一家游戏公司的开发人员,现在需要你开发一款叫做<人狗大战> ...

  6. Python Day7

    概述 面向对象高级语法部分 静态方法.类方法.属性方法 类的特殊方法 反射 静态方法 通过@staticmethod装饰器即可把其装饰的方法变为一个静态方法,什么是静态方法呢?其实不难理解,普通的方法 ...

  7. Python之路,Day7 - 面向对象编程进阶

    本节内容: 面向对象高级语法部分 经典类vs新式类 静态方法.类方法.属性方法 类的特殊方法 反射 异常处理 Socket开发基础 作业:开发一个支持多用户在线的FTP程序 经典类vs新式类 把下面代 ...

  8. 冲刺阶段day7

    day7 项目进展 又是一个周三,有轮到我写东西了.首先我们对昨天的成果调试了几遍,改了几个小Bug之后就没有什么问题了,完善了登录界面的代码,学生管理这部分终于被敲定下来,并且正式完工了.然后还生下 ...

  9. python学习之路-day7

    本节内容: 面向对象高级语法部分 静态方法.类方法.属性方法 类的特殊方法 反射 异常处理 Socket开发基础 面向对象高级语法部分 静态方法                             ...

随机推荐

  1. dll详解

    [转]http://www.cnblogs.com/xuemaxiongfeng/articles/2461632.html 不解为什么要用WINAPI宏定义,查了后发现下面的定义.于是乎需要区别 _ ...

  2. 1146 ID Codes

    题目链接: http://poj.org/problem?id=1146 题意: 给定一个字符串(长度不超过50), 求这个字符串的下一个字典序的字符串, 如果已经是最大字典序, 那么输出 " ...

  3. SpringMVC源码解读 - RequestMapping注解实现解读 - RequestCondition体系

    一般我们开发时,使用最多的还是@RequestMapping注解方式. @RequestMapping(value = "/", param = "role=guest& ...

  4. Spring bean管理器 bean实例化的三种方式

    bean实例化的三种方式实现 第一种:使用类的无参数构造方法创建(常用 重要) 第一种实例化方式最常用,实例化类时会通过调用无参构造方法创建.示例代码如下: package spring.com.Us ...

  5. MVC4 Model ValueProvider

    1. NameValueCollectionValueProvider: ValueProvider 的数据容器一般具有类似字典的结构.NameValueCollection 表示一种 key 和va ...

  6. 什么是C#?什么是.NET Framework?

    1.什么是C#: 解1:C#就是一门开发语言,是由C及C++演变而来的,有朋友戏称之为"C四个+",这里的"#"号,不读"井",而读做&qu ...

  7. c#设计模式系列:命令模式(Command Pattern)

    引言 命令模式,我感觉"命令"就是任务,执行了命令就完成了一个任务.或者说,命令是任务,我们再从这个名字上并不知道命令的发出者和接受者分别是谁,为什么呢?因为我们并不关心他们是谁, ...

  8. CentOS下Docker与.netcore(四)之 三剑客之一Docker-machine+jenkins简单自动化部署

    CentOS下Docker与.netcore(一) 之 安装 CentOS下Docker与.netcore(二) 之 Dockerfile CentOS下Docker与.netcore(三)之 三剑客 ...

  9. python学习之路 二 :基本数据类型

    本节重点 理解什么是变量? 掌握各种数据类型 理解可变类型和不可变类型 一.变量和常量 变量: 作用:存贮程序的中间结果在内存里,以备后边的程序调用 定义规范: 变量名只能是 字母.数字活下划线的任意 ...

  10. 「SHOI2016」黑暗前的幻想乡

    题目链接 戳我 \(Describe\) \(n−1\)个公司,每个公司能修一些边,求每条边都让不同的公司来修的生成树的方案数 \(Solution\) 这道题很明显容斥.答案就是:所有都选的生成树个 ...