PersonalCorpus 版 (精华区)

寄信人: ooze (烂泥~苦读武侠中)
标  题: 147
发信站: 哈工大紫丁香 (2002年06月19日13:00:51 星期三)
来  源: 202.118.239.224 

908743 2002/06/19 05:01:47.984
Big Guava ... 147 C++ Accepted 0:00.010 64

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <math.h>
#include <ctype.h>


void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\uva\\input147.txt","r",stdin);
    freopen("c:\\uva\\output147.txt","w",stdout);
#endif
    int s[5001],t[5001];
    int p[9]={10,20,50,100,200,500,1000,2000,5000};
    int i,j,k,l;
    float x;
    
    memset(s,0,sizeof(s));
    for (i=0;i<5001;i+=5) s[i]=1;
    for (l=0;l<9;l++) {
        memcpy(t,s,sizeof(s));
        for (k=p[l];k<=5000;k+=p[l])
            for (i=5000;i-k>=0;i-=5) s[i]+=t[i-k];
    }
    scanf("%f\n",&x);
    do {
        printf("%5.2f%12d\n",x,s[(int)(x*100)]);
        scanf("%f\n",&x);
    } while (x!=0);
}

※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.239.224]
--
※ 转寄:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: 202.118.239.224]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.452毫秒