SGU 117Counting(快速幂)
来源:互联网 发布:快速买火车票软件 编辑:程序博客网 时间:2024/06/06 07:08
快速幂水题。
/*********************** author:crazy_石头* Pro:SGU 117* algorithm:quick pow* Time:0ms* Judge Status:Accepted***********************/#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>using namespace std;#define LL long long#define rep(i,h,n) for(int i=(h);i<=(n);i++)#define ms(a,b) memset((a),(b),sizeof(a))#define INF 1<<29const int maxn=10000+5;int n,m,k;inline int quick_pow(int a,int b){ int ret=1; while(b) { if(b&1) ret=(LL)ret*a%k; b>>=1; a=(LL)a*a%k; } return ret;}int main(){ scanf("%d%d%d",&n,&m,&k); int cnt=0,s,h; rep(i,0,n-1) { scanf("%d",&s); if(quick_pow(s,m)%k==0) cnt++; } printf("%d\n",cnt); return 0;}
- SGU 117Counting(快速幂)
- SGU 117 Counting(快速幂)
- SGU 117. Counting 快速幂
- 【SGU】117. Counting 快速幂
- SGU - 117 - Counting (快速幂取模!)
- SGU 117 Counting 数论
- sgu 117 Counting
- SGU 117 Counting
- [SGU]117. Counting
- Sgu 117. Counting
- sgu 197 Nice Patterns Strike Back 矩阵快速幂
- sgu 117
- sgu 197 Nice Patterns Strike Back(构造矩阵快速幂)
- SGU
- SGU
- SGU
- SGU
- SGU
- java非常有用的代码段(关键时候可以看看)
- pyside-lupdate 解析问题
- perl哈希hash的常见用法介绍
- Run iOS Simulator from the Command Line (runsim)
- Windows Store 平台移植 —— (7) 网络 API
- SGU 117Counting(快速幂)
- sizeof总结
- hdu2000~hdu2099
- linux串口编程详解
- linux下安装flash插件安装jdk安装tomcat安装eclipse安装mysql
- VB.NET可选参数例子
- RSA DSA DEMO
- Windows Store 平台移植 —— (8)C,C++库构建
- 猜数字