首页 > 其他 > 详细

hdu 5138(水题)

时间:2016-07-13 11:49:07      阅读:199      评论:0      收藏:0      [点我收藏+]

题目链接:

http://acm.hdu.edu.cn/showproblem.php?pid=5138

 

反着来.

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include <queue>
using namespace std;

int main()
{
    int a[5] = {1,2,4,7,15};
    int n;
    while(scanf("%d",&n)!=EOF){
        int ans[5];
        int id = 0;
        while(id<5){
            if(n-a[id]<=0) break;
            ans[id++] = n-a[id];
        }
        for(int i=id-1;i>=1;i--){
            printf("%d ",ans[i]);
        }
        printf("%d\n",ans[0]);
    }
    return 0;
}

 

hdu 5138(水题)

原文:http://www.cnblogs.com/liyinggang/p/5666179.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!