摘要: #include<iostream>usingnamespacestd;intcount(intx,inty){if(y==1||x==0)return1;if(x<y)returncount(x,x);returncount(x,y-1)+count(x-y,y);}intmain(){intt,m,n;cin>>t;for(inti=0;i<t;i++){cin>>m>>n;cout<<count(m,n)<<endl;}while(1);return0;} 阅读全文
posted @ 2012-04-08 13:17 逝者*恋世 阅读(158) 评论(0) 推荐(0) 编辑
摘要: #include<stack>#include<cmath>#include<iostream>usingnamespacestd;voidconversion(intdata){stack<int>s;if(data==0)cout<<"0";elseif(data<0){intdatai;datai=abs(data);while(datai!=0){s.push(datai%6);datai=datai/6;}cout<<"-";while(s.empty()!=true 阅读全文
posted @ 2012-04-08 13:11 逝者*恋世 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include<string>#include<iostream>usingnamespacestd;structInfo{stringsex;floata,b,c,d,e;};intmain(){Infoinfo[101];intn,i,k=0;cin>>n;while(k<n){intcountN=0,countI=0;cin>>info[i].sex>>info[i].a>>info[i].b>>info[i].c>>info[i].d>>info[i].e;if(info 阅读全文
posted @ 2012-04-07 15:53 逝者*恋世 阅读(115) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;int a[100000]={0};int main(){int n;int i,len=1,j,temp=0;cin>>n;a[0]=1;for(i=2;i<=n;i++){for(j=0;j<len;j++){a[j]=i*a[j]+temp;temp=a[j]/10;a[j]%=10;}while(temp!=0){a[j++]=temp%10;temp/=10;}len=j;}len+=50-len%50;for(i=len-1;i>=0;i--){if((i+1)%5 阅读全文
posted @ 2012-04-07 13:50 逝者*恋世 阅读(238) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>int main(){ int i,n,a,sum; sum=0; scanf("%d%d",&a,&n); for(i=0;i<n;i++) { sum+=a; a=a%10+10*a; } printf("%d\n",sum); return 0;} 阅读全文
posted @ 2012-04-07 12:35 逝者*恋世 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N=1000;char a[N];int b[3*N];int main(){ while(scanf("%s",a)!=EOF) { memset(b,0,sizeof(b)); int len=strlen(a); int iKeep,iTez,iToz=0; for(int i=len-1;i>=2;i--) { iTez=0; iKeep=0; int iNu 阅读全文
posted @ 2012-04-07 11:41 逝者*恋世 阅读(345) 评论(0) 推荐(0) 编辑
摘要: POJ Biorhythms解题一、题目Description人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。对于每个人,我们想知道何时三个高峰落在同一天。对于每个周期,我们会给出从当前年份的第一天开始,到出现高峰的天数(不一定是第一次高峰出现的时间)。你的任务是给定一个从当年第一天开始数的天数,输出从给定时间开始(不包括给定时间)下一次三个高峰落在同一天的时间(距给定时间 阅读全文
posted @ 2012-04-05 19:35 逝者*恋世 阅读(401) 评论(1) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;int main(){int i,j=0,k=1;cin>>i;while(i){j=k*(i%10);k*=8;i=i/10;}cout<<j<<endl;return 0;} 阅读全文
posted @ 2012-04-05 19:25 逝者*恋世 阅读(203) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include<string.h>using namespace std;int qnum[93];void Display(bool flag[][8]){ static int num = 0; num++; int temp = 0; for (int i=0;i<8;i++) { for (int j=0;j<8;j++) { if (flag[i][j]) temp = temp*10+j+1; } } qnum[num] = temp;}bool Search(bool flag[][8],int m,in 阅读全文
posted @ 2012-04-04 21:44 逝者*恋世 阅读(126) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> int main() { int nCase,nFeet,i;scanf("%d",&nCase);for(i=1;i<=nCase;i++){ scanf("%d",&nFeet); if(nFeet%2 != 0)printf("0 0\n"); else if(nFeet%4 != 0) printf("%d %d\n",nFeet/4+1,nFeet/2); else printf("%d %d\n",nFeet/4, 阅读全文
posted @ 2012-04-04 21:23 逝者*恋世 阅读(122) 评论(0) 推荐(0) 编辑