• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

2012 Asia Chengdu Regional Contest Problem I

Count

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


Problem Description
Prof. Tigris is the head of an archaeological team who is currently in charge of an excavation in a site of ancient relics.
This site contains relics of a village where civilization once flourished. One night, examining a writing record, you find some text meaningful to you. It reads as follows.
“Our village is of glory and harmony. Our relationships are constructed in such a way that everyone except the village headman has exactly one direct boss and nobody will be the boss of himself, the boss of boss of himself, etc. Everyone expect the headman is considered as his boss’s subordinate. We call it relationship configuration. The village headman is at level 0, his subordinates are at level 1, and his subordinates’ subordinates are at level 2, etc. Our relationship configuration is harmonious because all people at same level have the same number of subordinates. Therefore our relationship is …”
The record ends here. Prof. Tigris now wonder how many different harmonious relationship configurations can exist. He only cares about the holistic shape of configuration, so two configurations are considered identical if and only if there’s a bijection of n people that transforms one configuration into another one.
Please see the illustrations below for explanation when n = 2 and n = 4.

The result might be very large, so you should take module operation with modules 109 +7 before print your answer.
 

 

Input
There are several test cases.
For each test case there is a single line containing only one integer n (1 ≤ n ≤ 1000).
Input is terminated by EOF.
 

 

Output
For each test case, output one line “Case X: Y” where X is the test case number (starting from 1) and Y is the desired answer.
 

 

Sample Input
1
2
3
40
50
600
700
 

 

Sample Output
Case 1: 1
Case 2: 1
Case 3: 2
Case 4: 924
Case 5: 1998
Case 6: 315478277
Case 7: 825219749
 

 

Source
2012 Asia Chengdu Regional Contest
 

 

Recommend
liuyiding   |   We have carefully selected several similar problems for you:  4769 4767 4766 4765 4763 
 1 #pragma comment(linker, "/STACK:1024000000,1024000000")
 2 #include <map>
 3 #include <queue>
 4 #include <vector>
 5 #include <string>
 6 #include <cstdio>
 7 #include <cstring>
 8 #include <iostream>
 9 #include <algorithm>
10 using namespace std;
11 #define maxn 10005
12 #define mod 1000000007
13 #define ll long long
14 #define INF 0x7fffffff
15 int n, m, s;
16 ll f[maxn];
17 void init(){
18     f[1] = 1;
19     for (int i = 2; i <= 1000; i++)
20         for (int j = 1; j < i;j++)
21             if ((i - 1) % j == 0)f[i] = (f[i]+f[(i-1)/j])%mod;
22 }
23 int main(){
24     int cas = 1;
25     int t;
26     init();
27     /*scanf("%d", &t);
28     while (t--){
29         scanf("%d", &n);
30         printf("%I64d\n", f[n]);
31     }*/
32     while (~scanf("%d", &n)){
33         printf("Case %d: ", cas++);
34         printf("%I64d\n", f[n]);
35     }
36     return 0;
37 }
View Code 2013-10-25 14:51:19 
posted @ 2013-10-24 23:27  HaibaraAi  阅读(86)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3