2012年4月10日

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 不悔梦归处 阅读(170) 评论(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 不悔梦归处 阅读(219) 评论(0) 推荐(0) 编辑

1040: Count

摘要: 1040: CountTime Limit: 1 SecMemory Limit: 128 MBSubmit: 2Solved: 2[Submit][Status][Web Board]DescriptionMany ACM team name may be very funny,such as "Complier_Error","VVVVV".Oh,wait for a minute here.Is it "W W"+"V",or "W"+"V V V",or someth 阅读全文

posted @ 2012-04-10 22:29 不悔梦归处 阅读(203) 评论(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 不悔梦归处 阅读(164) 评论(0) 推荐(0) 编辑

导航