摘要: 1 2 #include 3 int main() 4 { 5 int n; 6 while(scanf("%d",&n),n) 7 { 8 int s=0,m,t; 9 while(n>2)10 { 11 t=n%3;12 m=n/3;13 s+=m;14 n=m+t; 15 }16 if(n==2)17 s++;18 printf("%d\n",s);19 }20 }21 阅读全文
posted @ 2013-08-20 11:24 hpu张亚飞 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1 2 #include 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int a,sum[45];10 scanf("%d",&a);11 if(a<3)12 printf("%d\n",a-1);13 14 else15 {16 sum[1]=1;17 sum[2]=1;18 for(int i=3;i<a+1;i++)19 sum[i]=sum[i-1]+sum[i-2];20 printf("%d\n" 阅读全文
posted @ 2013-08-20 10:53 hpu张亚飞 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1 2 #include 3 #include 4 #include 5 6 int main() 7 { 8 double a1,a2,b1,b2,c1,c2; 9 while(scanf("%lf %lf %lf %lf %lf %lf",&a1,&a2,&b1,&b2,&c1,&c2),(a1||a2||b1||b2||c1||c2))10 {11 double a,b,c,s,q;12 13 a=sqrt((b1-c1)*(b1-c1)+(b2-c2)*(b2-c2));14 b=sqrt((a1-c1)*... 阅读全文
posted @ 2013-08-20 10:52 hpu张亚飞 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1 2 #include 3 int main() 4 { 5 int a[1002],i,j,n,k; 6 scanf("%d%d",&n,&k); 7 a[0]=0; 8 for(i=1;i<n+1;i++) 9 a[i]=1;10 for(j=2;j<=k;j++)11 {12 for(i=1;i<n+1;i++)13 if(i%j==0)14 a[i]=1-a[i];15 }16 for(i=0;i<n+1;i++)17 if(a[i]=... 阅读全文
posted @ 2013-08-20 10:51 hpu张亚飞 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 这个是结构体写的WS 了 一直不知道错哪里 1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 struct gl 9 {10 int li;11 int ri;12 }d[10010];13 int cmp( gl x, gl y)14 {15 if(x.li!=y.li)16 return x.lid[i].ri)32 33 {34 t=d[i].li;35 d[i]... 阅读全文
posted @ 2013-08-20 10:50 hpu张亚飞 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1 2 #include 3 int ma{4 unsigned long long t,m,temp=471;5 scanf("%llu",&t);6 while(t--&&scanf("%llu",&m))7 printf("%llu\n",temp+1000*(m-1));8 } 阅读全文
posted @ 2013-08-20 10:45 hpu张亚飞 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1 2 #include 3 int main() 4 { 5 int n,i,a,b,c,t; 6 scanf("%d",&n); 7 while(n--) 8 { 9 scanf("%d",&a);10 for(i=1;i=a) break;14 }15 if(t&1)16 printf("%d/%d\n",t-a+1+(t-1)*t/2,a-t*(t-1)/2);17 18 else19 printf("%d/%d\n",a... 阅读全文
posted @ 2013-08-20 10:43 hpu张亚飞 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 int main() 9 {10 int n,i,k;11 while(~scanf("%d %d",&n,&k))12 {13 int a[110000],s=0;14 for(i=0;i<n;i++)15 scanf("%d",&a[i]);16 sort(a,a+n);17 for(i=0;i<k;i++)18 s+=a[i];19 printf("%d\n& 阅读全文
posted @ 2013-08-20 10:42 hpu张亚飞 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int main() 3 { 4 int a,m,n,i,j,t; 5 scanf("%d",&a); 6 while(a--) 7 { int b[110]={0}; 8 scanf("%d%d",&m,&n); 9 for(i=0;i 2 #include 3 #include 4 #include 5 using namespace std; 6 int cmp( const void*a, const void*b) 7 { 8 return *(int *)a - * (int *)b; 9 } 阅读全文
posted @ 2013-08-20 10:40 hpu张亚飞 阅读(180) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1201#include#includeint mo[13]={31,28,31,30,31,30,31,31,30,31,30,31};int nian(int a){ if(a%4==0&&a%100!=0||a%400==0) return 1; return 0;} /*int ri(int a,int b,int c){ int i, day=0; if(a) mo[1]+=1; for(i=0;i<b;i++) day+=mo[i]; day+=c; return day; } 阅读全文
posted @ 2013-08-17 08:23 hpu张亚飞 阅读(199) 评论(0) 推荐(0) 编辑