hdu 5138 CET-6 test(简单模拟)

CET-6 test

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 645    Accepted Submission(s): 466


Problem Description
Small W will take part in CET-6 test which will be held on December  20th . In order to pass it he must remember a lot of words.
He remembers the words according to Ebbinghaus memory curve method.
He separates the words into many lists. Every day he picks up a new list, and in the next  1st,2nd,4th,7th,15th  day, he reviews this list.
So every day he has many lists to review. However he is so busy, he does not know which list should be reviewed in a certain day. Now he invites you to write a program to tell him which list should to be reviewed in a certain day.
Lists are numbered from 1. For example list 1 should be reviewed in the  2nd,3rd,5th,8th,16th  day.
 

Input
Multi test cases (about 100), every case contains an integer n in a single line. 
Please process to the end of file.

[Technical Specification]
2n100000
 

Output
For each n,output the list which should be reviewed in the  nth  day in ascending order.
 

Sample Input
  
  
2 100
 

Sample Output
  
  
1 85 93 96 98 99
题意:给你一个n,输出需要复习的天数,需要复习的分别为n的前1,2,4,7,15天

代码:

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

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int flag=0;
        if(n-15>=1)
        {
            printf("%d",n-15);
            flag=1;
        }
        if(n-7>=1)
        {
            if(flag) printf(" ");
            printf("%d",n-7);
            flag=1;
        }
        if(n-4>=1)
        {
            if(flag) printf(" ");
            printf("%d",n-4);
            flag=1;
        }
        if(n-2>=1)
        {
            if(flag) printf(" ");
            printf("%d",n-2);
            flag=1;
        }
        if(n-1>=1)
        {
            if(flag) printf(" ");
            printf("%d",n-1);
        }
        printf("\n");
    }
    return 0;
}




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值