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++中不同类之间的赋值问题——存疑
operator=不能重载为全局函数.理由如下 void operator=(int i , A& a) { a.a = i } ; 那么将会出现 99 = a 这种代码,但是99不是左值, ...
- linux的“自动化”-乾颐堂CCIE
linux系统的web网站在运营状态时,我们常需要对网站进行维护,例如查看资源剩余并做出响应.日志分割.数据整理,在特定状态执行特定任务等等,这些都会需要linux能实现自动执行某些任任务.本篇博文介 ...
- 配置GIT DIFF/MERGE TOOL
关闭prompt backup git config --global difftool.prompt false git config --global mergetool.prompt false ...
- HttpClient 上传/下载文件计算文件传输进度
1.使用ProgressMessageHandler 获取进度 using namespace System.Net.Http; HttpClientHandler hand = new HttpCl ...
- [GO]并的爬取捧腹的段子
package main import ( "fmt" "strconv" "net/http" "regexp" &q ...
- android session解析
最近在开发项目的过程中,遇到Android与web服务器要在同一session下通信的问题. 在解决问题前先回顾下Session与Cookie: Cookie和Session都为了用来保存状态信息,都 ...
- Word2010如何编辑好了直接发布csdn博文?
目前大部分的博客作者在写博客这件事情上都会遇到以下3个痛点:1.所有博客平台关闭了文档发布接口,用户无法使用Word,Windows Live Writer等工具来发布博客.2.发布到博客或公众号平台 ...
- thinkjs用户请求处理
- 15、Semantic-UI之导航
15.1 面包屑导航 在Semantic-UI中有多种样式实现面包屑导航,类似 / > 等. 示例:定义定义基础面包屑导航 <div class="ui container& ...
- Java NIO学习-详细内容(三)
九.nio.file 该包是1.7新出的,包含了一系列高级的文件和目录操作方法 1.控制目录属性,只读,系统之类的 2.监控文件及文件夹的改变的WatchService public void sta ...