首页 > ACM题库 > HDU-杭电 > HDU 3808-Celebration of Stefanie’s Wedding[解题报告]HOJ
2015
04-13

HDU 3808-Celebration of Stefanie’s Wedding[解题报告]HOJ

Celebration of Stefanie’s Wedding

问题描述 :

Today is May 8th, the mother’s day. At first let’s bless Mother’s Day to the mothers of the world with our most respect.
What’s more, it’s maybe a more significant day for at least one person, and maybe the happiest, the most wonderful, the most memorable, the most splendid, the most fantastic… for her, Stefanie, from Singapore, the favorite singer of iSea.
With white pure dress, with the music of Mendelssohn, with the red carpet, with the focus of all others’ sight, with the lover on today and forever, she is on the way to another new start of her life, beginning with the wedding.
So, don’t be stingy, let’s give the best blessing for her. Your program’s output should begin with “Best wishes to Stefanie”. As a faithful fan, to show more sincere blessing, iSea choose his favorite TOPTEN songs:

1.Yu Jian
2.Tin O O
3.I Missed
4.Stefanie
5.The Same
6.About
7.Honey Honey
8.Unfinished
9.Hey Jude
10.When Winter Fades

iSea will listen to these songs alternately and circularly, i.e. one after one and after the last one beginning from the first one again from tomorrow, May 9th 2011. He will listen to exactly one song for one day, except the weekends, Saturday and Sunday, when he will play SanGuoSha and DotA Games. Being addicted in those fairs, he wants to ask you which song he should hear today.

输入:

The first line contains a single integer T, indicating the number of test cases.
Each test case begins with only one integers N, means N day(s) after today. You can assume the day won’t be weekends and in the range of 32-bit integer.

输出:

The first line contains a single integer T, indicating the number of test cases.
Each test case begins with only one integers N, means N day(s) after today. You can assume the day won’t be weekends and in the range of 32-bit integer.

样例输入:

3
1
3
5

样例输出:

Best wishes to Stefanie

Yu Jian
I Missed
The Same

#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <fstream>
#include <sstream>
using namespace std;

#define FS(i,a) for(int i=0;a[i];++i)
#define FD(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,a) for(int i=0;i<a;++i)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define PR2(a,n,m) REP(i,n){REP(j,m)cout<<a[i][j]<<' ';puts("");}
#define MP make_pair
#define CLQ(que) while(!que.empty()) que.pop();
#define CL(m,what) memset(m,what,sizeof(m))
#define READ(a) freopen(a,"r",stdin)
#define WRITE(a) freopen(a,"w",stdout)
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define checkMin(a,b) (a=min(a,b))
#define checkMax(a,b) (a=max(a,b))
#define sq(a) ((a)*(a))
#define INF 100000000
#define EPS 1e-8
const double pi = acos(-1.0);
int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1}; //up Right down Left
int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int, int> PII;
//------------------------------------------------------------------------------
char ans[10][100] = {
 "Yu Jian",
"Tin O O",
"I Missed",
"Stefanie",
"The Same",
"About",
"Honey Honey",
"Unfinished",
"Hey Jude",
"When Winter Fades"
};

int main() {
#ifndef ONLINE_JUDGE
#endif
 int T;
 LL n;
 cin >> T;
 puts("Best wishes to Stefanie\n");
 while (T--) {
 cin >> n;
 --n;
 n %= 14;
 if (n < 5)
 puts(ans[n]);
 else {
 puts(ans[n - 7 + 5]);
 }

 }
 return 0;
}

  1. 学算法中的数据结构学到一定程度会乐此不疲的,比如其中的2-3树,类似的红黑树,我甚至可以自己写个逻辑文件系统结构来。

  2. #include <cstdio>

    int main() {
    //answer must be odd
    int n, u, d;
    while(scanf("%d%d%d",&n,&u,&d)==3 && n>0) {
    if(n<=u) { puts("1"); continue; }
    n-=u; u-=d; n+=u-1; n/=u;
    n<<=1, ++n;
    printf("%dn",n);
    }
    return 0;
    }

  3. 换句话说,A[k/2-1]不可能大于两数组合并之后的第k小值,所以我们可以将其抛弃。
    应该是,不可能小于合并后的第K小值吧

  4. A猴子认识的所有猴子和B猴子认识的所有猴子都能认识,这句话用《爱屋及乌》描述比较容易理解……