摘要: 没说的 暴力打表#include#includeusing namespace std;int a[62768];int b[42768];int prime[42768];int main(){ int n=0,j,i; memset(b,0,sizeof(b)); memset... 阅读全文
posted @ 2014-04-28 21:43 _一千零一夜 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 典型的快速幂成应用题意:求x 使得x^e%n=num#includeusing namespace std;bool funtion(int x,int e,int n,int num){// m^n % k int b = 1; while (e > 0) { i... 阅读全文
posted @ 2014-04-28 20:59 _一千零一夜 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题意:求N!中末尾0的个数 其实就是5的个数 因为2*5=10 肯定n中2的个数比5的个数多#includeusing namespace std;int main(){ int n; int t,d; int sum; scanf("%d",&t); while(t... 阅读全文
posted @ 2014-04-28 20:03 _一千零一夜 阅读(97) 评论(0) 推荐(0) 编辑
摘要: % mod 比较基本的广搜 有些数论知识 第一次在节点力用了队列 挺好#include#includeusing namespace std;struct Node{ int x; int step; queue q;};int v[1000010];int n,m,k;bool bfs(){ int s=((n+1)%k+k)%k; queueq; Node now,next; now.x=n;now.step=0; q.push(now); memset(v,0,sizeof(v)); while(!q.empty()) {... 阅读全文
posted @ 2014-04-28 17:48 _一千零一夜 阅读(83) 评论(0) 推荐(0) 编辑