#P232A. Cycles
Cycles
Cycles
题面翻译
题目描述
构造一个无向图(没有自环),使这个无向图恰好有 个三元环,输出这个无向图的 矩阵。
无向图的顶点数不超过
输入输出格式
输入格式:
一行一个整数 。
输出格式:
第一行为无向图的顶点数 ,接下来 行为这个无向图的 矩阵,不需要输出空格。
题目描述
John Doe started thinking about graphs. After some thought he decided that he wants to paint an undirected graph, containing exactly cycles of length .
A cycle of length is an unordered group of three distinct graph vertices , and , such that each pair of them is connected by a graph edge.
John has been painting for long, but he has not been a success. Help him find such graph. Note that the number of vertices there shouldn't exceed , or else John will have problems painting it.
输入格式
A single line contains an integer ( ) — the number of cycles of length in the required graph.
输出格式
In the first line print integer ( ) — the number of vertices in the found graph. In each of next lines print characters "0" and "1": the -th character of the -th line should equal "0", if vertices and do not have an edge between them, otherwise it should equal "1". Note that as the required graph is undirected, the -th character of the -th line must equal the -th character of the -th line. The graph shouldn't contain self-loops, so the -th character of the -th line must equal "0" for all .
样例 #1
样例输入 #1
1
样例输出 #1
3
011
101
110
样例 #2
样例输入 #2
10
样例输出 #2
5
01111
10111
11011
11101
11110
相关
在以下作业中: