CF1032B.Personalized Cup

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

At many competitions that have a word «cup» in its official name the winner is presented with an actual cup. This time the organizers of one unusual programming competition have decided to please the winner even more and to add a nameplate to the cup with the handle of the winner.

The nameplate is to be rectangular and the text on it will be printed as a table of several rows and columns. Having some measurements done, the organizers have found out that the number aa of rows cannot be greater than 55 while the number bb of columns cannot exceed 2020. Every cell of the table will contain either an asterisk («*») or a letter of user's handle.

Furthermore, the organizers want the rows of the table to be uniform, which means that the number of asterisks used in different rows should differ by at most one (i.e. you can't have two asterisks in the first row and none in the second). The main goal, however, is to obtain the winner's handle precisely when reading the table from top to bottom and from left to right in every row (skipping asterisks).

The organizers want for the nameplate to have as few rows as possible and among all valid tables with the minimum number of rows they want to choose the one that has the minimum number of columns.

The winner is not yet determined so your task is to write a program that, given a certain handle, generates the necessary table.

许多官方名称中包含“cup”一词的比赛,其冠军会获赠一个真正的奖杯。本次,一场别开生面的编程竞赛的组织者决定进一步取悦冠军——在奖杯上加装一块铭牌,并在上面镌刻冠军的用户名(handle)。

该铭牌为矩形,其上的文字将以一个具有若干行与列的表格形式印刷。经过一些测量,组织者发现:行数 aa 不得超过 55,而列数 bb 不得超过 2020。表格的每个单元格中将填入一个星号(*)或用户 handle 中的一个字母。

此外,组织者希望表格各行保持“均匀性”,即不同行中所用星号的数量之差至多为 11(例如,不允许第一行有 22 个星号而第二行一个也没有)。然而,最主要的目标是:当按从上到下、每行内再从左到右的顺序遍历整个表格(跳过所有星号)时,恰好能读出冠军的完整 handle。

组织者希望铭牌的行数尽可能少;在所有满足最小行数的合法表格中,再选择列数最少的那个。

目前冠军尚未确定,因此你的任务是编写一个程序:给定某个 handle,生成满足上述要求的表格。

输入格式

The only line contains one string ss (1≤∣s∣≤1001 \le |s| \le 100), comprised of uppercase and lowercase Latin letters, — the handle of the winner.

唯一的一行包含一个字符串 ss(1≤∣s∣≤1001 \le |s| \le 100),由大写和小写拉丁字母组成——即获胜者的用户名。

输出格式

In the first line output the minimum number aa of rows in the table and the minimum number bb of columns in an optimal table with rows.

The following aa lines should contain bb characters each — any valid table.

第一行输出最优表格的最小行数 aa 和最小列数 bb。

接下来的 aa 行,每行应包含 bb 个字符——即任意一个合法的表格。

输入输出样例

  • 输入#1

    tourist

    输出#1

    1 7
    tourist
  • 输入#2

    MyNameIsLifeIAmForeverByYourSideMyNameIsLife

    输出#2

    3 15
    MyNameIsLifeIAm
    ForeverByYourSi
    deMyNameIsL*ife

输入解题思路,AI测评打分。不知道怎么写?

首页