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开发基础 面向对象高级语法部分 静态方法 ...
随机推荐
- [C++] static member variable and static const member variable
static member variable[可读可写] 可以通过指针间接修改变量的值 static const member variable[只读] 压根就不可以修改变量的值,会报错
- It's not too late to start!
It's not too late to start! 以此鼓励,希望能坚持下去,一个半路自学PHP的准PHPer!
- ubuntu启动流程和要读取相关文件
当前系统环境为:linux mint mate 17.1(基于ubuntu14.04的衍生版) 查阅资料后总结如下: 首先: /etc/rc.d链接目标为:/etc /etc/rc*.d文件夹中的脚本 ...
- 常用工具类——StringUtils
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreem ...
- [原创]COCOS2DX 3.8 增加protobuf为external库
此处为记录防止忘记,最近使用COCOS练习一些新的库,所以需要把PROTOBUF编译进去,看上去很麻烦,这里记录一下,以防忘记. 首先下载protobuf 2.5.0版本,下载地址请自行百度. 准备工 ...
- Android 修改 TextView 的全局默认颜色。
如果你的应用中大多数TextView的颜色是红色, 或者其他颜色, 你是为每一个TextView都设置一次颜色, 还是有其他更好的办法, 这里教你怎么修改TextView的默认颜色. 当然我们Text ...
- Activator不能创建包含范型参数的实例
Activator包含特定的方法,用以在本地或从远程创建对象类型,或获取对现有远程对象的引用.此类不能被继承. 具体介绍:http://msdn.microsoft.com/zh-cn/library ...
- mybatis 简单实现 left join
sql -- 表a ta (id,aname,bid) -- 表b tb (id,bname) SELECT T1.*, T2.BNAME FROM TA T1 LEFT JOIN TB T2 ON ...
- mysql复制表以及复制数据库
(一)将旧表复制到新表 1.CREATE TABLE新表 SELECT* FROM旧表; 该语句只是复制表结构以及数据,它不会复制与表关联的其他数据库对象,如索引,主键约束,外键约束,触发器等. CR ...
- Spring Boot - 记录日志
比自己写文本日志的好处 默认定义好了一些日志级别,会记录当前使用的级别以上的日志,通常线上环境设置的级别较高记得较少 有一些自动split之类的功能 Commons-logging 日志级别:TRAC ...