#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. 利用Ant与Proguard混淆

    利用Ant与Proguard混淆 摘自:https://blog.csdn.net/forlong401/article/details/22956711 2014年04月04日 20:20:21 f ...

  2. ArcGIS中地图导出格式比较(转)

    转自:http://blog.sina.com.cn/s/blog_6438c8360101eqfx.html   有人问过这样的问题,用于出挂图的地图格式应该怎么选择?熟悉ArcGIS的用户都知道, ...

  3. a 标签 name 属性 页面定位 (一)

    a(§b) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  4. sersync服务搭建

    前言: 一.为什么要用Rsync+sersync架构? 1.sersync是基于Inotify开发的,类似于Inotify-tools的工具 2.sersync可以记录下被监听目录中发生变化的(包括增 ...

  5. Android-Activity-startActivityForResult

    之前 Android-Intent意图传递数据,的博客讲解了,一个Activity 跳转 到另外一个Activity 可以把数据带过去 Android还提供了一种方式,一个Activity 跳转 到另 ...

  6. mvc4开篇之BundleConfig(1)

    新建一个mvc4默认项目,会看到以下目录 打开App_start 里面BundleConfig.cs文件 你会看到这么一段话: 有关 Bundling 的详细信息,请访问 http://go.micr ...

  7. Webserver asp配置及伪静态设置

    Webserver  IIS asp配置及伪静态设置 一.概述: 在Windows Server 2003系统中,用户可以借助IIS 6.0配置基于ASP.PHP.asp.NET等语言的动态Web网站 ...

  8. 「HNOI 2015」落忆枫音

    题目链接 戳我 \(Description\) 给一张\(n\)割点\(m\)条边的\(DAG\),保证点\(1\)不存在入边,现在需要在\(DAG\)中加入一条不在原图中的边\((x,y)\),求这 ...

  9. geth attach

    1. geth attachgeth attach ipc:\\.\pipe\geth.ipc2. "Error: insufficient funds for gas * price + ...

  10. Eclipse无法正常创建android工程解决方法!

    我最近升级了安卓的SDK,升级后发现无法在Eclipse中创建android工程了,创建的工程完毕后,没有自动生成这个工程的activity和对应的布局文件,上网搜索一番,最后终于解决了.可能是升级后 ...