- 博客(166)
- 收藏
- 关注
原创 信了你的邪之杭电1005
#include<stdio.h>//若用递归函数实现应该怎么操作 int main(){ int a,b,n,i,d,k; int s[51]={0,1,1};//定义长度为51,s[0],s[1],s[2]分别为0,1,1的数组 while(scanf("%d%d%d",&a,&b,&n)!=EOF&&a+b+n...
2018-11-05 17:08:44
171
原创 HD1004 数气球 http://acm.hdu.edu.cn/showproblem.php?pid=1004
一、/*(1)怎样计数,存储,比较 答:只存储需要输出的出现最多的颜色的次数 ,进行一个动态变化 那么怎么使得颜色和次数对应呢 每次动态变化时不仅仅是次数 同时还有标记颜色的i */ #include<stdio.h>#include<string.h>#define N 1001int main(){ int T=1,n,s,max,i,j,x...
2018-11-02 20:10:46
175
原创 hd 2098 分拆素数和
#includeint sushu(int n){ int i; for(i=2;i<=n/2;i++) { if(n%i==0) return 1;} return 0; }int main(){ int n,i,j; while(scanf("%d
2014-08-15 17:25:41
454
原创 hd 2097 sky数
#includeint main(){ int n,i,a,m,p,b,c,q; while(scanf("%d",&n)!=EOF&&n!=0) { a=b=c=0; m=n; p=n; q=n; while(n>0) { a+=n%10; n/=
2014-08-15 17:01:13
537
原创 hd 2084 数塔(dp)
#includeint main(){ int a[110][110],t,n,i,j; while(scanf("%d",&t)!=EOF) { while(t--) { scanf("%d",&n); for(i=1;i<=n;i++) for(j=1;j<=i;j++)
2014-08-15 15:36:41
354
原创 hd 2052 Picture
#includeint main(){ int n,m,i,j; while(scanf("%d%d",&n,&m)!=EOF) { for(i=0;i<n+2;i++) { if(i==0||i==n+1) printf("+"); else printf("-");
2014-08-15 11:11:48
282
原创 hd 2028 Lowest Common Multiple Plus
#includeint main(){ int n,m,i,j,p; int a[100]; while(scanf("%d",&n)!=EOF) { scanf("%d",&a[0]); p=a[0]; for(i=1;i<n;i++) { scanf("%d",&a[i]);
2014-08-15 09:26:53
354
原创 hd 2029 Palindromes _easy version
#include#includeint main(){ int t,i,j,p; char s[100],a[100]; while(scanf("%d",&t)!=EOF) { getchar(); while(t--) { gets(s); p=strlen(s); j=0; for(i=str
2014-08-15 08:44:41
257
原创 ny 465 最大值和最小值
原题链接#include#include#includebool cmp(int a,int b){ return a>b; }using namespace std;int main(){ int t,i; char a[110]; while(scanf("%d",&t)!=EOF) { getchar(); memset(a,0,size
2014-08-14 23:33:02
319
原创 ny 436 sum of all integer numbers
#include#includeint main(){ int n; while(scanf("%d",&n)!=EOF) { printf("%d\n",(abs(n-1)+1)*(n+1)/2); }return 0; }
2014-08-14 23:04:12
273
原创 hd 2022 海选女主角
#include//#include#includeint main(){ int n,m,a,i,j,x,y,t; while(scanf("%d%d",&n,&m)!=EOF) { t=0; for(i=1;i<=n;i++) for(j=1;j<=m;j++) { scanf(
2014-08-14 19:40:18
602
原创 hd 2023 求平均成绩
#include #includeint main(){ int n,m,s[60][10],i,j,k,l; double a[60],b[10]; while(scanf("%d%d",&n,&m)!=EOF) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b));
2014-08-14 19:14:09
372
原创 hd 1597 find the nth digit(解决超时的牛气哄哄的新办法)
find the nth digitTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8385 Accepted Submission(s): 2394Problem Description假设:S1 = 1S2
2014-08-14 16:57:10
474
原创 南阳 463 九九乘法表
#includeint main(){ int t,p=0,n,i,j; while(scanf("%d",&t)!=EOF) { while(t--) { scanf("%d",&n); if(p++) printf("\n"); for(i=1;i<=n;i++) { for(j
2014-08-14 12:42:31
405
原创 hd 2092 整数解
#includeint main(){ int n,m,i,j,p; while(scanf("%d%d",&n,&m)!=EOF&&(m!=0||n!=0)) { j=0; if(m<0) { m=-m; j=1; } for(i=-m;i<=m;i++)
2014-08-14 11:35:16
418
原创 hd 1412 {A} + {B}
{A} + {B}Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11795 Accepted Submission(s): 4926Problem Description给你两个集合,要求{A} + {
2014-08-13 10:38:46
291
原创 hd 1555 How many days?
#includeint main(){ int m,s,k,i,p; while(scanf("%d%d",&m,&k)!=EOF&&(m!=0||k!=0)) { s=m; while(m>=k) { s+=m/k; m=m%k+m/k;
2014-08-13 08:59:13
357
原创 hd 2134 Cuts the cake
#include#include#define PI 3.1415926int main(){ double r,s,r1,r2; while(scanf("%lf",&r)!=EOF&&(r!=0)) { s=PI*r*r; r1=(double)sqrt(s/(3*PI)); r2=(double)sqrt
2014-08-12 19:54:43
319
原创 hd 3279 Nth Largest Value
CTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1004 Accepted Submission(s): 796Problem DescriptionFor this problem, you will wr
2014-08-12 18:44:17
341
原创 hd 3201 Build a Fence
Build a FenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 943 Accepted Submission(s): 744Problem DescriptionThere is a
2014-08-12 17:53:32
526
原创 hd 2566 统计硬币(循环法,母函数法)no
统计硬币Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3845 Accepted Submission(s): 2694Problem Description假设一堆由1分、2分、5分组成的n个硬币总面值
2014-08-12 16:34:47
418
原创 hd 3079 Vowel Counting
#include#includeint main(){ int t,i; char s[60]; while(scanf("%d",&t)!=EOF) { getchar(); while(t--) { gets(s); for(i=0;i<strlen(s);i++)
2014-08-12 15:59:49
292
原创 hd 2719 The Seven Percent Solution
#include#includeint main(){ int i; char a[90]; while(gets(a)>0) { if(a[0]=='#') break; else { for(i=0;i<strlen(a);i++) { if(a
2014-08-12 15:40:44
530
原创 hd 2734 Quicksum
QuicksumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2196 Accepted Submission(s): 1676Problem DescriptionA checksum is an al
2014-08-12 15:21:47
306
原创 hd 2700 Parity
ParityTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2296 Accepted Submission(s): 1790Problem DescriptionA bit string has odd
2014-08-12 15:03:18
277
原创 hd 2569 彼岸
#includeint main(){ int t,i,n; __int64 a[50]; while(scanf("%d",&t)!=EOF) { while(t--) { scanf("%d",&n); a[1]=3; a[2]=9; for(i=3;i<40
2014-08-12 10:55:59
277
原创 hd 2567 寻梦
#include#includeint main(){ int i,j,t; char a[60],b[60],c[60],d[60]; while(scanf("%d",&t)!=EOF) { getchar(); while(t--) { gets(a); gets
2014-08-12 10:30:47
260
原创 hd 2568 前进
#includeint main(){ int t,i,s,n; while(scanf("%d",&t)!=EOF) { while(t--) { s=0; scanf("%d",&n); while(n>0) { if(n%2==1)
2014-08-12 10:16:29
333
原创 hd 2562 奇偶位互换
奇偶位互换Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4531 Accepted Submission(s): 3476Problem Description给定一个长度为偶数位的0,1字符串,请编程实
2014-08-12 10:04:06
451
原创 ny 532 不吉利的数字 no
#includeint main(){ int i,n,m,p,t; int a[10]; while(scanf("%d",&n)!=EOF) { i=0; m=n; while(n>0) { a[i++]=n%10; n/=10;} p=i; t=1; for(i=0;i<p;i++)
2014-08-11 23:40:13
1925
原创 hd 2393 Higher Math
#include#includeusing namespace std;int main(){ int t,a[5],k,i; while(scanf("%d",&t)!=EOF) { k=0; while(t--) { for(i=0;i<3;i++) scanf("%d",&a[i]);
2014-08-11 20:56:54
454
原创 hd 2212 DFS
DFSTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5046 Accepted Submission(s): 3112Problem DescriptionA DFS(digital factorial su
2014-08-11 20:41:09
418
原创 hd 2317 Nasty Hacks
Nasty HacksTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2147 Accepted Submission(s): 1696Problem DescriptionYou are the CEO of Nas
2014-08-11 17:52:32
401
原创 hd 2123 An easy problem
#includeint main(){ int t,n,i,j; while(scanf("%d",&t)!=EOF) { while(t--) { scanf("%d",&n); for(i=1;i<=n;i++) for(j=1;j<=n;j++) {
2014-08-11 17:18:32
302
原创 hd 2077 汉诺塔IV
#include#includeint main(){ int n,t; __int64 s; while(scanf("%d",&t)!=EOF) { while(t--) { scanf("%d",&n); s=pow(3,n-1); printf("%I64d\n",s+
2014-08-11 16:08:26
287
原创 hd 2064 汉诺塔III
#include__int64 fun(int n){ int i; if(n==1) return 2; return fun(n-1)*3+2; }int main(){ int n; while(scanf("%d",&n)!=EOF) printf("%I64d\n",fun(n));ret
2014-08-11 15:54:54
325
原创 hd 2067 小兔的棋盘,二维数组的递归
#include#includeint main(){ int n,i,t,j; __int64 a[40][40]; memset(a,0,sizeof(a)); a[1][1]=1; for(i=2;i<=36;i++) for(j=1;j<=i;j++) a[i][j]=a[i-1][j]+a[i][j-1]; t=0; wh
2014-08-11 15:21:44
394
原创 ny 352 数乌龟
#includeint main(){ int n,i,a[60]; a[0]=1; a[1]=2; a[2]=3; for(i=3;i<56;i++) a[i]=a[i-1]+a[i-3]; while(scanf("%d",&n)!=EOF&&(n!=0)) printf("%d\n",a[n-1]);return 0;
2014-08-11 13:11:57
377
原创 hd 1465 不容易系列之一
#includeint main(){ int n,i; __int64 a[21]; while(scanf("%d",&n)!=EOF) { a[0]=1; a[1]=2; for(i=2;i<20;i++) a[i]=(i+1)*(a[i-1]+a[i-2]);
2014-08-11 11:31:26
301
原创 hd 2036 改革春风吹满地
改革春风吹满地Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18631 Accepted Submission(s): 9544Problem Description“ 改革春风吹满地,不会AC没关系
2014-08-11 11:00:21
419
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人