杭电5138-CET-6 test
来源:互联网 发布:jsp连接sql server 编辑:程序博客网 时间:2024/06/10 04:59
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]
2≤n≤100000
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
思路:其实这道题想明白了,很简单,就是一个记忆曲线,用输入的数减去15,7,4,1即可
#include<iostream>#include<stdio.h>using namespace std;int main(){int n;while(cin>>n){if(n>15){printf("%d %d %d %d %d\n",n-15,n-7,n-4,n-2,n-1);}else if(n>7&&n<=15)printf("%d %d %d %d\n",n-7,n-4,n-2,n-1);else if(n==2)printf("%d\n",n-1);else if(n>2&&n<=4)printf("%d %d\n",n-2,n-1);else if(n>4&&n<=7)printf("%d %d %d\n",n-4,n-2,n-1);}return 0;}还有一种简单的方法
#include<iostream>#include<stdio.h>using namespace std;int main(){ int n; while(cin>>n) { if(n>15) printf("%d ",n-15); if(n>7) printf("%d ",n-7); if(n>4) printf("%d ",n-4); if(n>2) printf("%d ",n-2); if(n>1) printf("%d\n",n-1); } return 0;}
- 杭电5138-CET-6 test
- hdu 5138 CET-6 test
- hdu 5138 CET-6 test
- hdu 5138 CET-6 test 5139 Formula
- HDU—— 5138 CET-6 test
- hdu 5138 CET-6 test(BestCoder Round #21)
- hdu 5138 CET-6 test(简单模拟)
- 【CUGBACM15级BC第21场 A】hdu 5138 CET-6 test
- HDU5138 CET-6 test && BestCoder Round #21 1001
- CET-6
- 杭电1847 Good Luck in CET-4 Everybody!(博弈)
- 杭电1847-Good Luck in CET-4 Everybody!--巴神博弈
- CET-6 作文热身
- CET-6归来
- CET-6 English Words
- CET-6(1-20160527)
- cet-6 words--day 1
- MY FIRST CET-6 journey
- 菜鸟学习Git技术系列--No.1
- telnet 发送邮件
- eoj1857
- [Code] 收集各种语言对图片的处理算法实现 图片模糊
- hihocoder#1015之KMP算法
- 杭电5138-CET-6 test
- android导入工程时显示红色大感叹号
- EOJ2253
- 数据结构之队列-顺序队列
- eoj2521
- HDU2136_Largest prime factor【水题】【筛法求素数】
- 浅析linux 2.6.23驱动自动匹配设备driver_attach()函数
- HDU 1753 大明A+B
- 百度贴吧头像上传无尺寸限制