gpt4 book ai didi

居中添加名称的 sprintf 消息

转载 作者:行者123 更新时间:2023-11-30 20:20:00 30 4
gpt4 key购买 nike

如果我仅使用Welcome消息,我的代码可以正常工作,但是当打印p->client_name指针时,消​​息不居中。

所以我的问题是如何将消息和客户端名称居中,就像它是一条消息一样。为什么它目前仅将消息欢迎居中

sprintf(message,"============================================================");
send_message(RED, message);
const char *mes = "Welcome";
sprintf(message, "[ %*s %s ]", (45 - strlen(message)) / 2 + ((strlen(message) % 2 == 0) ? 1 : 0) + strlen(message), mes, p->client_name);
send_message(RED, message);
sprintf(message,"============================================================");
send_message(RED, message);

示例:

=============================================
[ Welcome Carol ]
=============================================

最佳答案

原始问题解释的解决方案

这段代码看起来可以工作。注释解释了计算过程。测试代码展示了我如何测试这些东西。

/*
** Centre a pair of words in a given width without creating a single
** string to centre.
**
** Format will be "[ %*s %-*s ]"; what are the values required for the
** two lengths R1, R2 for a given width W and lengths L1, L2?
**
** +----------------------------------------------------------+
** [ @.........R1..........@ @..............R2..............@ ]
** [ XXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYYYYY ]
** [ G1 | L1 | | L2 | G2 ]
** +----------------------------------------------------------+
**
** W = G1 + L1 + 1 + L2 + G2
**
** G1 = G2 or G1 + 1 = G2
** L1 + L2 + 1 <= W (return G1 = G2 = 1 if it is bigger)
**
** For the purposes of the calculation, the leading "[ " and trailing " ]"
** are not counted as part of W.
**
** Total Padding T = W - (L1 + L2 + 1)
** Hence: G1 = T / 2
** G2 = T - G1
** R1 = L1 + G1
** R2 = L2 + G2
*/

static void centre_two_lengths(int w, int l1, int l2, int *r1, int *r2)
{
int t = w - (l1 + l2 + 1);
if (t <= 0)
{
*r1 = *r2 = 1;
}
else
{
int g1 = t / 2;
int g2 = t - g1;
*r1 = l1 + g1;
*r2 = l2 + g2;
}
}

#include <stdio.h>
#include <string.h>

static void test_width(int width)
{
const char *data[] =
{
"A", "B",
"AA", "B",
"A", "BB",
"A", "BBB",
"A", "BBBB",
"AAA", "B",
"Hello", "World",
"Middle of", "the road",
"Welcome", "to Jurassic Park",
"Bienvenue", "a Paris",
"Twelve Place", "Twice - Over",
"Eleven Here", "Thirteen Here",
"Much much longer", "than this",
"A", "Discourse on Inequality",
"What sort of pedant am", "I",
"What an essay", "busting all the limits",
};
int num_pairs = (sizeof(data) / sizeof(data[0])) / 2;

for (int i = 0; i < num_pairs; i++)
{
int r1;
int r2;
const char *s1 = data[2 * i + 0];
const char *s2 = data[2 * i + 1];
int l1 = strlen(s1);
int l2 = strlen(s2);
centre_two_lengths(width, l1, l2, &r1, &r2);
printf("W = %2d, L1 = %2d, L2 = %2d, R1 = %2d, R2 = %2d ", width, l1, l2, r1, r2);
printf("[ %*s %-*s ]\n", r1, s1, r2, s2);
}
}

int main(void)
{
for (int width= 24; width < 30; width++)
test_width(width);
return(0);
}

请注意,代码不会尝试处理 L1L2 为零的情况。在大多数情况下都可以这样做,除非非零长度太大。不过,这似乎没有必要。目标是将两个(非零长度)字符串居中。该计算也不会尝试处理字符串中的前导空格或尾随空格;简单地假设没有前导或尾随空格。它还假设一个单字节代码集;如果 UTF-8 包含 ASCII 范围之外的字符,它就无法正确居中(并且它也不会处理控制字符——退格、制表符、换行符、回车符等——明智地)。

输出:

W = 24, L1 =  1, L2 =  1, R1 = 11, R2 = 12   [           A B            ]
W = 24, L1 = 2, L2 = 1, R1 = 12, R2 = 11 [ AA B ]
W = 24, L1 = 1, L2 = 2, R1 = 11, R2 = 12 [ A BB ]
W = 24, L1 = 1, L2 = 3, R1 = 10, R2 = 13 [ A BBB ]
W = 24, L1 = 1, L2 = 4, R1 = 10, R2 = 13 [ A BBBB ]
W = 24, L1 = 3, L2 = 1, R1 = 12, R2 = 11 [ AAA B ]
W = 24, L1 = 5, L2 = 5, R1 = 11, R2 = 12 [ Hello World ]
W = 24, L1 = 9, L2 = 8, R1 = 12, R2 = 11 [ Middle of the road ]
W = 24, L1 = 7, L2 = 16, R1 = 1, R2 = 1 [ Welcome to Jurassic Park ]
W = 24, L1 = 9, L2 = 7, R1 = 12, R2 = 11 [ Bienvenue a Paris ]
W = 24, L1 = 12, L2 = 12, R1 = 1, R2 = 1 [ Twelve Place Twice - Over ]
W = 24, L1 = 11, L2 = 13, R1 = 1, R2 = 1 [ Eleven Here Thirteen Here ]
W = 24, L1 = 16, L2 = 9, R1 = 1, R2 = 1 [ Much much longer than this ]
W = 24, L1 = 1, L2 = 23, R1 = 1, R2 = 1 [ A Discourse on Inequality ]
W = 24, L1 = 22, L2 = 1, R1 = 1, R2 = 1 [ What sort of pedant am I ]
W = 24, L1 = 13, L2 = 22, R1 = 1, R2 = 1 [ What an essay busting all the limits ]
W = 25, L1 = 1, L2 = 1, R1 = 12, R2 = 12 [ A B ]
W = 25, L1 = 2, L2 = 1, R1 = 12, R2 = 12 [ AA B ]
W = 25, L1 = 1, L2 = 2, R1 = 11, R2 = 13 [ A BB ]
W = 25, L1 = 1, L2 = 3, R1 = 11, R2 = 13 [ A BBB ]
W = 25, L1 = 1, L2 = 4, R1 = 10, R2 = 14 [ A BBBB ]
W = 25, L1 = 3, L2 = 1, R1 = 13, R2 = 11 [ AAA B ]
W = 25, L1 = 5, L2 = 5, R1 = 12, R2 = 12 [ Hello World ]
W = 25, L1 = 9, L2 = 8, R1 = 12, R2 = 12 [ Middle of the road ]
W = 25, L1 = 7, L2 = 16, R1 = 7, R2 = 17 [ Welcome to Jurassic Park ]
W = 25, L1 = 9, L2 = 7, R1 = 13, R2 = 11 [ Bienvenue a Paris ]
W = 25, L1 = 12, L2 = 12, R1 = 1, R2 = 1 [ Twelve Place Twice - Over ]
W = 25, L1 = 11, L2 = 13, R1 = 1, R2 = 1 [ Eleven Here Thirteen Here ]
W = 25, L1 = 16, L2 = 9, R1 = 1, R2 = 1 [ Much much longer than this ]
W = 25, L1 = 1, L2 = 23, R1 = 1, R2 = 1 [ A Discourse on Inequality ]
W = 25, L1 = 22, L2 = 1, R1 = 22, R2 = 2 [ What sort of pedant am I ]
W = 25, L1 = 13, L2 = 22, R1 = 1, R2 = 1 [ What an essay busting all the limits ]
W = 26, L1 = 1, L2 = 1, R1 = 12, R2 = 13 [ A B ]
W = 26, L1 = 2, L2 = 1, R1 = 13, R2 = 12 [ AA B ]
W = 26, L1 = 1, L2 = 2, R1 = 12, R2 = 13 [ A BB ]
W = 26, L1 = 1, L2 = 3, R1 = 11, R2 = 14 [ A BBB ]
W = 26, L1 = 1, L2 = 4, R1 = 11, R2 = 14 [ A BBBB ]
W = 26, L1 = 3, L2 = 1, R1 = 13, R2 = 12 [ AAA B ]
W = 26, L1 = 5, L2 = 5, R1 = 12, R2 = 13 [ Hello World ]
W = 26, L1 = 9, L2 = 8, R1 = 13, R2 = 12 [ Middle of the road ]
W = 26, L1 = 7, L2 = 16, R1 = 8, R2 = 17 [ Welcome to Jurassic Park ]
W = 26, L1 = 9, L2 = 7, R1 = 13, R2 = 12 [ Bienvenue a Paris ]
W = 26, L1 = 12, L2 = 12, R1 = 12, R2 = 13 [ Twelve Place Twice - Over ]
W = 26, L1 = 11, L2 = 13, R1 = 11, R2 = 14 [ Eleven Here Thirteen Here ]
W = 26, L1 = 16, L2 = 9, R1 = 1, R2 = 1 [ Much much longer than this ]
W = 26, L1 = 1, L2 = 23, R1 = 1, R2 = 24 [ A Discourse on Inequality ]
W = 26, L1 = 22, L2 = 1, R1 = 23, R2 = 2 [ What sort of pedant am I ]
W = 26, L1 = 13, L2 = 22, R1 = 1, R2 = 1 [ What an essay busting all the limits ]
W = 27, L1 = 1, L2 = 1, R1 = 13, R2 = 13 [ A B ]
W = 27, L1 = 2, L2 = 1, R1 = 13, R2 = 13 [ AA B ]
W = 27, L1 = 1, L2 = 2, R1 = 12, R2 = 14 [ A BB ]
W = 27, L1 = 1, L2 = 3, R1 = 12, R2 = 14 [ A BBB ]
W = 27, L1 = 1, L2 = 4, R1 = 11, R2 = 15 [ A BBBB ]
W = 27, L1 = 3, L2 = 1, R1 = 14, R2 = 12 [ AAA B ]
W = 27, L1 = 5, L2 = 5, R1 = 13, R2 = 13 [ Hello World ]
W = 27, L1 = 9, L2 = 8, R1 = 13, R2 = 13 [ Middle of the road ]
W = 27, L1 = 7, L2 = 16, R1 = 8, R2 = 18 [ Welcome to Jurassic Park ]
W = 27, L1 = 9, L2 = 7, R1 = 14, R2 = 12 [ Bienvenue a Paris ]
W = 27, L1 = 12, L2 = 12, R1 = 13, R2 = 13 [ Twelve Place Twice - Over ]
W = 27, L1 = 11, L2 = 13, R1 = 12, R2 = 14 [ Eleven Here Thirteen Here ]
W = 27, L1 = 16, L2 = 9, R1 = 16, R2 = 10 [ Much much longer than this ]
W = 27, L1 = 1, L2 = 23, R1 = 2, R2 = 24 [ A Discourse on Inequality ]
W = 27, L1 = 22, L2 = 1, R1 = 23, R2 = 3 [ What sort of pedant am I ]
W = 27, L1 = 13, L2 = 22, R1 = 1, R2 = 1 [ What an essay busting all the limits ]
W = 28, L1 = 1, L2 = 1, R1 = 13, R2 = 14 [ A B ]
W = 28, L1 = 2, L2 = 1, R1 = 14, R2 = 13 [ AA B ]
W = 28, L1 = 1, L2 = 2, R1 = 13, R2 = 14 [ A BB ]
W = 28, L1 = 1, L2 = 3, R1 = 12, R2 = 15 [ A BBB ]
W = 28, L1 = 1, L2 = 4, R1 = 12, R2 = 15 [ A BBBB ]
W = 28, L1 = 3, L2 = 1, R1 = 14, R2 = 13 [ AAA B ]
W = 28, L1 = 5, L2 = 5, R1 = 13, R2 = 14 [ Hello World ]
W = 28, L1 = 9, L2 = 8, R1 = 14, R2 = 13 [ Middle of the road ]
W = 28, L1 = 7, L2 = 16, R1 = 9, R2 = 18 [ Welcome to Jurassic Park ]
W = 28, L1 = 9, L2 = 7, R1 = 14, R2 = 13 [ Bienvenue a Paris ]
W = 28, L1 = 12, L2 = 12, R1 = 13, R2 = 14 [ Twelve Place Twice - Over ]
W = 28, L1 = 11, L2 = 13, R1 = 12, R2 = 15 [ Eleven Here Thirteen Here ]
W = 28, L1 = 16, L2 = 9, R1 = 17, R2 = 10 [ Much much longer than this ]
W = 28, L1 = 1, L2 = 23, R1 = 2, R2 = 25 [ A Discourse on Inequality ]
W = 28, L1 = 22, L2 = 1, R1 = 24, R2 = 3 [ What sort of pedant am I ]
W = 28, L1 = 13, L2 = 22, R1 = 1, R2 = 1 [ What an essay busting all the limits ]
W = 29, L1 = 1, L2 = 1, R1 = 14, R2 = 14 [ A B ]
W = 29, L1 = 2, L2 = 1, R1 = 14, R2 = 14 [ AA B ]
W = 29, L1 = 1, L2 = 2, R1 = 13, R2 = 15 [ A BB ]
W = 29, L1 = 1, L2 = 3, R1 = 13, R2 = 15 [ A BBB ]
W = 29, L1 = 1, L2 = 4, R1 = 12, R2 = 16 [ A BBBB ]
W = 29, L1 = 3, L2 = 1, R1 = 15, R2 = 13 [ AAA B ]
W = 29, L1 = 5, L2 = 5, R1 = 14, R2 = 14 [ Hello World ]
W = 29, L1 = 9, L2 = 8, R1 = 14, R2 = 14 [ Middle of the road ]
W = 29, L1 = 7, L2 = 16, R1 = 9, R2 = 19 [ Welcome to Jurassic Park ]
W = 29, L1 = 9, L2 = 7, R1 = 15, R2 = 13 [ Bienvenue a Paris ]
W = 29, L1 = 12, L2 = 12, R1 = 14, R2 = 14 [ Twelve Place Twice - Over ]
W = 29, L1 = 11, L2 = 13, R1 = 13, R2 = 15 [ Eleven Here Thirteen Here ]
W = 29, L1 = 16, L2 = 9, R1 = 17, R2 = 11 [ Much much longer than this ]
W = 29, L1 = 1, L2 = 23, R1 = 3, R2 = 25 [ A Discourse on Inequality ]
W = 29, L1 = 22, L2 = 1, R1 = 24, R2 = 4 [ What sort of pedant am I ]
W = 29, L1 = 13, L2 = 22, R1 = 1, R2 = 1 [ What an essay busting all the limits ]
<小时/>

但我不是这个意思 - 我的意思是别的

这段代码似乎满足修改后的要求。

/*
** Given two words W1,W2, enclose them in square brackets "[ W1 W2]"
** Centre a pair of words in a given width without creating a single
** string to centre.
**
** Format will be "%*s[ %s %s ]%*s"; what are the values required for
** R1, R2 given the two lengths L1, L2 and width W?
**
** +----------------------------------------------------------+
** | |
** | [ XXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYYYYY ] |
** | R1 | | L1 | | L2 | | R2 |
** +----------------------------------------------------------+
**
** W = R1 + L1 + 5 + L2 + R2
**
** for centred output, either R1 = R2 or R1 + 1 = R2
** L1 + L2 + 5 <= W (return R1 = R2 = 0 if it is bigger)
**
** Total Padding T = W - (L1 + L2 + 5)
** Hence: R1 = T / 2
** R2 = T - R1
*/

static void centre_two_lengths(int w, int l1, int l2, int *r1, int *r2)
{
int t = w - (l1 + l2 + 5);
if (t <= 0)
{
*r1 = *r2 = 0;
}
else
{
*r1 = t / 2;
*r2 = t - *r1;
}
}

#include <stdio.h>
#include <string.h>

static void test_width(int width)
{
const char *data[] =
{
"A", "B",
"AA", "B",
"A", "BB",
"A", "BBB",
"A", "BBBB",
"AAA", "B",
"Hello", "World",
"Middle of", "the road",
"Welcome", "to Jurassic Park",
"Bienvenue", "a Paris",
"Twelve Place", "Twice - Over",
"Eleven Here", "Thirteen Here",
"Much much longer", "than this",
"A", "Discourse on Inequality",
"What sort of pedant am", "I",
"What an essay", "busting all the limits",
};
int num_pairs = (sizeof(data) / sizeof(data[0])) / 2;

for (int i = 0; i < num_pairs; i++)
{
int r1;
int r2;
const char *s1 = data[2 * i + 0];
const char *s2 = data[2 * i + 1];
int l1 = strlen(s1);
int l2 = strlen(s2);
centre_two_lengths(width, l1, l2, &r1, &r2);
printf("W = %2d, L1 = %2d, L2 = %2d, R1 = %2d, R2 = %2d ", width, l1, l2, r1, r2);
printf("|%*s[ %s %s ]%*s|\n", r1, "", s1, s2, r2, "");
}
}

int main(void)
{
for (int width= 28; width < 34; width++)
test_width(width);
return(0);
}

如果您不需要尾随空格,您可以简化该函数 - 它可以简单地返回前导空格所需的值,并且您可以从格式字符串和 r2 以及后续的 ""。垂直条的存在只是为了让您可以看到数据是否正确居中(并且尾随条需要尾随空格才能有意义)。

输出:

W = 28, L1 =  1, L2 =  1, R1 = 10, R2 = 11   |          [ A B ]           |
W = 28, L1 = 2, L2 = 1, R1 = 10, R2 = 10 | [ AA B ] |
W = 28, L1 = 1, L2 = 2, R1 = 10, R2 = 10 | [ A BB ] |
W = 28, L1 = 1, L2 = 3, R1 = 9, R2 = 10 | [ A BBB ] |
W = 28, L1 = 1, L2 = 4, R1 = 9, R2 = 9 | [ A BBBB ] |
W = 28, L1 = 3, L2 = 1, R1 = 9, R2 = 10 | [ AAA B ] |
W = 28, L1 = 5, L2 = 5, R1 = 6, R2 = 7 | [ Hello World ] |
W = 28, L1 = 9, L2 = 8, R1 = 3, R2 = 3 | [ Middle of the road ] |
W = 28, L1 = 7, L2 = 16, R1 = 0, R2 = 0 |[ Welcome to Jurassic Park ]|
W = 28, L1 = 9, L2 = 7, R1 = 3, R2 = 4 | [ Bienvenue a Paris ] |
W = 28, L1 = 12, L2 = 12, R1 = 0, R2 = 0 |[ Twelve Place Twice - Over ]|
W = 28, L1 = 11, L2 = 13, R1 = 0, R2 = 0 |[ Eleven Here Thirteen Here ]|
W = 28, L1 = 16, L2 = 9, R1 = 0, R2 = 0 |[ Much much longer than this ]|
W = 28, L1 = 1, L2 = 23, R1 = 0, R2 = 0 |[ A Discourse on Inequality ]|
W = 28, L1 = 22, L2 = 1, R1 = 0, R2 = 0 |[ What sort of pedant am I ]|
W = 28, L1 = 13, L2 = 22, R1 = 0, R2 = 0 |[ What an essay busting all the limits ]|
W = 29, L1 = 1, L2 = 1, R1 = 11, R2 = 11 | [ A B ] |
W = 29, L1 = 2, L2 = 1, R1 = 10, R2 = 11 | [ AA B ] |
W = 29, L1 = 1, L2 = 2, R1 = 10, R2 = 11 | [ A BB ] |
W = 29, L1 = 1, L2 = 3, R1 = 10, R2 = 10 | [ A BBB ] |
W = 29, L1 = 1, L2 = 4, R1 = 9, R2 = 10 | [ A BBBB ] |
W = 29, L1 = 3, L2 = 1, R1 = 10, R2 = 10 | [ AAA B ] |
W = 29, L1 = 5, L2 = 5, R1 = 7, R2 = 7 | [ Hello World ] |
W = 29, L1 = 9, L2 = 8, R1 = 3, R2 = 4 | [ Middle of the road ] |
W = 29, L1 = 7, L2 = 16, R1 = 0, R2 = 1 |[ Welcome to Jurassic Park ] |
W = 29, L1 = 9, L2 = 7, R1 = 4, R2 = 4 | [ Bienvenue a Paris ] |
W = 29, L1 = 12, L2 = 12, R1 = 0, R2 = 0 |[ Twelve Place Twice - Over ]|
W = 29, L1 = 11, L2 = 13, R1 = 0, R2 = 0 |[ Eleven Here Thirteen Here ]|
W = 29, L1 = 16, L2 = 9, R1 = 0, R2 = 0 |[ Much much longer than this ]|
W = 29, L1 = 1, L2 = 23, R1 = 0, R2 = 0 |[ A Discourse on Inequality ]|
W = 29, L1 = 22, L2 = 1, R1 = 0, R2 = 1 |[ What sort of pedant am I ] |
W = 29, L1 = 13, L2 = 22, R1 = 0, R2 = 0 |[ What an essay busting all the limits ]|
W = 30, L1 = 1, L2 = 1, R1 = 11, R2 = 12 | [ A B ] |
W = 30, L1 = 2, L2 = 1, R1 = 11, R2 = 11 | [ AA B ] |
W = 30, L1 = 1, L2 = 2, R1 = 11, R2 = 11 | [ A BB ] |
W = 30, L1 = 1, L2 = 3, R1 = 10, R2 = 11 | [ A BBB ] |
W = 30, L1 = 1, L2 = 4, R1 = 10, R2 = 10 | [ A BBBB ] |
W = 30, L1 = 3, L2 = 1, R1 = 10, R2 = 11 | [ AAA B ] |
W = 30, L1 = 5, L2 = 5, R1 = 7, R2 = 8 | [ Hello World ] |
W = 30, L1 = 9, L2 = 8, R1 = 4, R2 = 4 | [ Middle of the road ] |
W = 30, L1 = 7, L2 = 16, R1 = 1, R2 = 1 | [ Welcome to Jurassic Park ] |
W = 30, L1 = 9, L2 = 7, R1 = 4, R2 = 5 | [ Bienvenue a Paris ] |
W = 30, L1 = 12, L2 = 12, R1 = 0, R2 = 1 |[ Twelve Place Twice - Over ] |
W = 30, L1 = 11, L2 = 13, R1 = 0, R2 = 1 |[ Eleven Here Thirteen Here ] |
W = 30, L1 = 16, L2 = 9, R1 = 0, R2 = 0 |[ Much much longer than this ]|
W = 30, L1 = 1, L2 = 23, R1 = 0, R2 = 1 |[ A Discourse on Inequality ] |
W = 30, L1 = 22, L2 = 1, R1 = 1, R2 = 1 | [ What sort of pedant am I ] |
W = 30, L1 = 13, L2 = 22, R1 = 0, R2 = 0 |[ What an essay busting all the limits ]|
W = 31, L1 = 1, L2 = 1, R1 = 12, R2 = 12 | [ A B ] |
W = 31, L1 = 2, L2 = 1, R1 = 11, R2 = 12 | [ AA B ] |
W = 31, L1 = 1, L2 = 2, R1 = 11, R2 = 12 | [ A BB ] |
W = 31, L1 = 1, L2 = 3, R1 = 11, R2 = 11 | [ A BBB ] |
W = 31, L1 = 1, L2 = 4, R1 = 10, R2 = 11 | [ A BBBB ] |
W = 31, L1 = 3, L2 = 1, R1 = 11, R2 = 11 | [ AAA B ] |
W = 31, L1 = 5, L2 = 5, R1 = 8, R2 = 8 | [ Hello World ] |
W = 31, L1 = 9, L2 = 8, R1 = 4, R2 = 5 | [ Middle of the road ] |
W = 31, L1 = 7, L2 = 16, R1 = 1, R2 = 2 | [ Welcome to Jurassic Park ] |
W = 31, L1 = 9, L2 = 7, R1 = 5, R2 = 5 | [ Bienvenue a Paris ] |
W = 31, L1 = 12, L2 = 12, R1 = 1, R2 = 1 | [ Twelve Place Twice - Over ] |
W = 31, L1 = 11, L2 = 13, R1 = 1, R2 = 1 | [ Eleven Here Thirteen Here ] |
W = 31, L1 = 16, L2 = 9, R1 = 0, R2 = 1 |[ Much much longer than this ] |
W = 31, L1 = 1, L2 = 23, R1 = 1, R2 = 1 | [ A Discourse on Inequality ] |
W = 31, L1 = 22, L2 = 1, R1 = 1, R2 = 2 | [ What sort of pedant am I ] |
W = 31, L1 = 13, L2 = 22, R1 = 0, R2 = 0 |[ What an essay busting all the limits ]|
W = 32, L1 = 1, L2 = 1, R1 = 12, R2 = 13 | [ A B ] |
W = 32, L1 = 2, L2 = 1, R1 = 12, R2 = 12 | [ AA B ] |
W = 32, L1 = 1, L2 = 2, R1 = 12, R2 = 12 | [ A BB ] |
W = 32, L1 = 1, L2 = 3, R1 = 11, R2 = 12 | [ A BBB ] |
W = 32, L1 = 1, L2 = 4, R1 = 11, R2 = 11 | [ A BBBB ] |
W = 32, L1 = 3, L2 = 1, R1 = 11, R2 = 12 | [ AAA B ] |
W = 32, L1 = 5, L2 = 5, R1 = 8, R2 = 9 | [ Hello World ] |
W = 32, L1 = 9, L2 = 8, R1 = 5, R2 = 5 | [ Middle of the road ] |
W = 32, L1 = 7, L2 = 16, R1 = 2, R2 = 2 | [ Welcome to Jurassic Park ] |
W = 32, L1 = 9, L2 = 7, R1 = 5, R2 = 6 | [ Bienvenue a Paris ] |
W = 32, L1 = 12, L2 = 12, R1 = 1, R2 = 2 | [ Twelve Place Twice - Over ] |
W = 32, L1 = 11, L2 = 13, R1 = 1, R2 = 2 | [ Eleven Here Thirteen Here ] |
W = 32, L1 = 16, L2 = 9, R1 = 1, R2 = 1 | [ Much much longer than this ] |
W = 32, L1 = 1, L2 = 23, R1 = 1, R2 = 2 | [ A Discourse on Inequality ] |
W = 32, L1 = 22, L2 = 1, R1 = 2, R2 = 2 | [ What sort of pedant am I ] |
W = 32, L1 = 13, L2 = 22, R1 = 0, R2 = 0 |[ What an essay busting all the limits ]|
W = 33, L1 = 1, L2 = 1, R1 = 13, R2 = 13 | [ A B ] |
W = 33, L1 = 2, L2 = 1, R1 = 12, R2 = 13 | [ AA B ] |
W = 33, L1 = 1, L2 = 2, R1 = 12, R2 = 13 | [ A BB ] |
W = 33, L1 = 1, L2 = 3, R1 = 12, R2 = 12 | [ A BBB ] |
W = 33, L1 = 1, L2 = 4, R1 = 11, R2 = 12 | [ A BBBB ] |
W = 33, L1 = 3, L2 = 1, R1 = 12, R2 = 12 | [ AAA B ] |
W = 33, L1 = 5, L2 = 5, R1 = 9, R2 = 9 | [ Hello World ] |
W = 33, L1 = 9, L2 = 8, R1 = 5, R2 = 6 | [ Middle of the road ] |
W = 33, L1 = 7, L2 = 16, R1 = 2, R2 = 3 | [ Welcome to Jurassic Park ] |
W = 33, L1 = 9, L2 = 7, R1 = 6, R2 = 6 | [ Bienvenue a Paris ] |
W = 33, L1 = 12, L2 = 12, R1 = 2, R2 = 2 | [ Twelve Place Twice - Over ] |
W = 33, L1 = 11, L2 = 13, R1 = 2, R2 = 2 | [ Eleven Here Thirteen Here ] |
W = 33, L1 = 16, L2 = 9, R1 = 1, R2 = 2 | [ Much much longer than this ] |
W = 33, L1 = 1, L2 = 23, R1 = 2, R2 = 2 | [ A Discourse on Inequality ] |
W = 33, L1 = 22, L2 = 1, R1 = 2, R2 = 3 | [ What sort of pedant am I ] |
W = 33, L1 = 13, L2 = 22, R1 = 0, R2 = 0 |[ What an essay busting all the limits ]|

关于居中添加名称的 sprintf 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47740652/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com