hdu 5138(水题)

题目链接:

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;
}

 

posted @ 2016-07-13 11:11  樱花庄的龙之介大人  阅读(164)  评论(0编辑  收藏  举报