300657: CF125C. Hobbits' Party

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hobbits' Party

题意翻译

## 题意 众所周知霍比特人喜欢组织各式各样的聚会。共有 $n$ 名霍比特人住在夏尔,组织方决定组织一场持续多天的狂欢,现在准备列出宾客名单。组织方的原则是服务至上,让每位来的宾客满意,所以他们不一定邀请所有的人,而是让每天狂欢的人数相等。为了让每个人都玩儿的尽兴,对于任意两天,都要有至少有同一位宾客被邀请,但是对于任意三天,都不能有同一个宾客被邀请,否则他会觉得太无聊。为了让狂欢持续最多天,请你帮忙设计出宾客名单。 ## 输入描述 输入只有一个整数 $n(3\leq n\leq 10000)$,表示霍比特人的数量。 ## 输出描述 输出第一行为一个整数 $k$,表示狂欢可以持续的天数; 接下来 $k$ 行,分别输出每天的宾客名单,用编号 $1$ 到 $n$ 表示。

题目描述

Everyone knows that hobbits love to organize all sorts of parties and celebrations. There are $ n $ hobbits living in the Shire. They decided to organize the Greatest Party (GP) that would last for several days. Next day the hobbits wrote a guest list, some non-empty set containing all the inhabitants of the Shire. To ensure that everybody enjoy themselves and nobody gets bored, for any two days (say, days A and B) of the GP there existed at least one hobbit, invited to come on day A and on day B. However, to ensure that nobody has a row, for any three different days A, B, C there shouldn't be a hobbit invited on days A, B and C. The Shire inhabitants are keen on keeping the GP going for as long as possible. Your task is given number $ n $ , to indicate the GP's maximum duration and the guest lists for each day.

输入输出格式

输入格式


The first line contains an integer $ n $ ( $ 3<=n<=10000 $ ), representing the number of hobbits.

输出格式


In the first output line print a number $ k $ — the maximum duration of GP in days. Then on $ k $ lines print the guest lists, (the guests should be separated by spaces). Print each guest list on the single line. Each list can contain an arbitrary positive number of hobbits. The hobbits are numbered with integers from $ 1 $ to $ n $ .

输入输出样例

输入样例 #1

4

输出样例 #1

3
1 2 
1 3 
2 3 

输入样例 #2

5

输出样例 #2

3
1 2 
1 3 
2 3 

Input

题意翻译

## 题意 众所周知霍比特人喜欢组织各式各样的聚会。共有 $n$ 名霍比特人住在夏尔,组织方决定组织一场持续多天的狂欢,现在准备列出宾客名单。组织方的原则是服务至上,让每位来的宾客满意,所以他们不一定邀请所有的人,而是让每天狂欢的人数相等。为了让每个人都玩儿的尽兴,对于任意两天,都要有至少有同一位宾客被邀请,但是对于任意三天,都不能有同一个宾客被邀请,否则他会觉得太无聊。为了让狂欢持续最多天,请你帮忙设计出宾客名单。 ## 输入描述 输入只有一个整数 $n(3\leq n\leq 10000)$,表示霍比特人的数量。 ## 输出描述 输出第一行为一个整数 $k$,表示狂欢可以持续的天数; 接下来 $k$ 行,分别输出每天的宾客名单,用编号 $1$ 到 $n$ 表示。

加入题单

算法标签: