随笔分类 -  zoj

Humble Numbers 1095
摘要:View Code #include <iostream>using namespace std;int a[5844];int min(int b,int c,int d,int e){ int t; t=b<c?b:c; t=t<d?t:d; t=t<e?t:e; return t;}int main(){ int i=0; a[i]=1; int x=0,y=0,z=0,m=0; while(i<=5843) { a[++i]=min(a[x]*2,a[y]*3,a[z]*5,a[m]*7); if(... 阅读全文

posted @ 2012-04-10 22:37 不悔梦归处 阅读(182) 评论(0) 推荐(0)

ZOJ Problem Set - 1089 Lotto
摘要:LottoTime Limit: 2 Seconds Memory Limit: 65536 KBIn a Lotto I have ever played, one has to select 6 numbers fromView Code #include <iostream>#include <algorithm>#include <fstream>using namespace std;int main(){ // ofstream cout("1.txt"); int a[20]; int n; int cae=0; while 阅读全文

posted @ 2012-04-10 22:33 不悔梦归处 阅读(234) 评论(0) 推荐(0)

快速求幂模板
摘要:#include <iostream>using namespace std;struct s{int a[2][2];};int p;s work(s x,s y){s c;for (int i=0;i<2;i++){for (int j=0;j<2;j++){c.a[i][j]=0;for (int k=0;k<2;k++)c.a[i][j]+=x.a[i][k]*y.a[k][j];c.a[i][j]%=p;} }return c;}s mod(s t,int n){s m; if (n==0||n==1) {return t; }if (n%2){ m=m 阅读全文

posted @ 2012-04-10 22:13 不悔梦归处 阅读(174) 评论(0) 推荐(0)

导航