CDQZ Day7
#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的更多相关文章
- CDQZ集训DAY7 日记
并没有考试然而心情比考试还糟糕…… 上午讲的基本就听不懂,讲课人迷之停顿.根本让人跟不上趟,声音好奇怪的说……好不容易讲到反演,Hzoi集体上线,等待装逼时刻的到来.然而,讲课人再次迷之停顿,讲一个p ...
- CDQZ多校集训记
20171218 DAY0 初相逢 今天的阳光很好,确实好极了.下午开始时,mercer说门外站了一堆人,我看都不用看就知道是衡水的.衡水人,怎么说呢,觉得还是挺不一样的.不知道像凡哥和超哥这种奇异的 ...
- 记一周cdqz训练
#include <cstdio> using namespace std; int main(){ puts("转载请注明出处:http://www.cnblogs.com/w ...
- day7
本节作业: 选课系统 角色:学校.学员.课程.讲师要求:1. 创建北京.上海 2 所学校2. 创建linux , python , go 3个课程 , linux\py 在北京开, go 在上海开3. ...
- Python之路,Day7 - Python基础7 面向对象
本节内容: 面向对象编程介绍 为什么要用面向对象进行开发? 面向对象的特性:封装.继承.多态 类.方法. 引子 你现在是一家游戏公司的开发人员,现在需要你开发一款叫做<人狗大战> ...
- Python Day7
概述 面向对象高级语法部分 静态方法.类方法.属性方法 类的特殊方法 反射 静态方法 通过@staticmethod装饰器即可把其装饰的方法变为一个静态方法,什么是静态方法呢?其实不难理解,普通的方法 ...
- Python之路,Day7 - 面向对象编程进阶
本节内容: 面向对象高级语法部分 经典类vs新式类 静态方法.类方法.属性方法 类的特殊方法 反射 异常处理 Socket开发基础 作业:开发一个支持多用户在线的FTP程序 经典类vs新式类 把下面代 ...
- 冲刺阶段day7
day7 项目进展 又是一个周三,有轮到我写东西了.首先我们对昨天的成果调试了几遍,改了几个小Bug之后就没有什么问题了,完善了登录界面的代码,学生管理这部分终于被敲定下来,并且正式完工了.然后还生下 ...
- python学习之路-day7
本节内容: 面向对象高级语法部分 静态方法.类方法.属性方法 类的特殊方法 反射 异常处理 Socket开发基础 面向对象高级语法部分 静态方法 ...
随机推荐
- Windows Server 2012 R2 Standard x64 deploy Visual Studio 2015 Application
When I run the Server application on Windows Server 2012 R2 operation system. I meet the error:MSVCP ...
- code1043 方格取数
第一次走用dfs枚举每种情况,第二次走用dp求剩下的最大值 设一个点集q用来保存有价值的点,排序,在最后加一个终点:x=m+1,y=m+1,v=0 //m是矩阵长宽 因为v=0的点是没有意义的,所以 ...
- [SoapUI] 通过Groovy写文本文件
如果文件已经存在,先删除,然后向文件中追加失败信息 if(maxRecordFail>0){ def testResultFile = new File(projectDir+"\\T ...
- STM32F4库函数里面的RCC_DeInit(void)函数分析
void RCC_DeInit(void) { /*Set HSION bit,内部高速时钟使能HSI振荡器打开*/ RCC->CR |=(uint32_t)0x00000001; /*Rese ...
- [GO]revoer的应用
error的函数只是用来报一些低等级的错误,panic是报那些会导致程序崩溃的错误,但是会有一个问题就是panic也会导致程序中断 ,如果我们需要程序在报错之后继续运行并报出错误的信息 就需要使用到r ...
- javascript总结46: JS三大系列-方便的offset 家族
1 offset 家族 offset这个单词本身是--偏移,补偿,位移的意思. js中有一套方便的获取元素尺寸的办法就是offset家族: 2 offset 结构介绍为: 3 offset常用属性 ...
- Java书籍经典Top10
1)Java Language Specification, Third Edition (by James Gosling) 本书由Java技术的发明者编写,是Java TM编程语言的权威性技术指南 ...
- 深入理解linux的权限设置和SUID,SGID以及粘滞位
我们知道文件的权限可以用三个八进制数字表示.其实文件的权限应该用四个八进制来表示,不过用 ls -l 命令时,只显示三个罢了.那个没有显示的八进制数字其实是第一个,它用来设定一些特殊权限.这个八进制数 ...
- mysql转ElasticSearch的分析 及JAVA API 初探
前言 最近工作中在进行一些技术优化,为了减少对数据库的压力,对于只读操作,在程序与db之间加了一层-ElasticSearch.具体实现是db与es通过bin-log进行同步,保证数据一致性,代码调用 ...
- IT技术公众号推荐
获取二维码方法:http://open.weixin.qq.com/qr/code/?username=公众账号,例如:cjscwe_2015 目录 全栈 编程语言 前端开发 移动开发 数据库 操 ...