- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果我仅使用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);
}
请注意,代码不会尝试处理 L1
或 L2
为零的情况。在大多数情况下都可以这样做,除非非零长度太大。不过,这似乎没有必要。目标是将两个(非零长度)字符串居中。该计算也不会尝试处理字符串中的前导空格或尾随空格;简单地假设没有前导或尾随空格。它还假设一个单字节代码集;如果 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/
我正在尝试做这样的事情:Name[i] = "Name"+ (i+1) 在 forloop 中,这样数组的值将是:Name[0] = Name1,Name[1] = Name2,Name[2] = N
我读了here,在GSP中我们可以这样写: ${params.action} 从GSP中,我们可以使用${params.action}作为参数调用Javascript函数(请参阅here)。 是否有其
我的问题:非常具体。我正在尝试想出解析以下文本的最简单方法: ^^domain=domain_value^^version=version_value^^account_type=account_ty
我创建了一条与此类似的路线: Router::connect("/backend/:controller/:action/*"); 现在我想将符合此模式的每个 Controller 路由重命名为类似
我在 Visual Studio 2013 项目中收到以下警告: SQL71502 - Procedure has an unresolved reference to object 最佳答案 这可以
任何人都可以指导我使用名称/值 .NET 集合或 .NET 名称/值字典以获得最佳性能吗?请问最好的方法是什么?我的应用程序是 ASP.NET、WCF/WF Web 应用程序。每个集合应该有 10 到
我在 Zend Framework 2 中有一个默认模块: namespace Application\Controller; use Zend\Mvc\Controller\AbstractActi
这是表格: 关于javascript - 在 javascript 中,这是一个有效的结构吗? : document. 名称.名称.值?,我们在Stack Overflow上找到一个类似的
HtmlHelper.ActionLink(htmlhelper,string linktext,string action) 如何找出正确的路线? 如果我有这个=> HtmlHelper.Actio
我需要一些有关如何将 Controller 定义传递给嵌套在 outer 指令中的 inner 指令的帮助。请参阅http://plnkr.co/edit/Om2vKdvEty9euGXJ5qan一个
请提出一个数据结构来表示内存中的记录列表。每条记录由以下部分组成: 用户名 积分 排名(基于积分)- 可选字段- 可以存储在记录中或可以动态计算 数据结构应该支持高效实现以下操作: Insert(re
错误 : 联合只能在具有兼容列类型的表上执行。 结构(层:字符串,skyward_number:字符串,skyward_points:字符串)<> 结构(skyward_number:字符串,层:字符
我想要一个包含可变数量函数的函数,但我希望在实际使用它们之前不要对它们求值。我可以使用 () => type 语法,但我更愿意使用 => type 语法,因为它似乎是为延迟评估而定制的。 当我尝试这样
我正在编写一个 elisp 函数,它将给定键永久绑定(bind)到当前主要模式的键盘映射中的给定命令。例如, (define-key python-mode-map [C-f1] 'pytho
卡在R中的错误上。 Error in names(x) <- value : 'names' attribute must be the same length as the ve
我有字符串,其中包含名称,有时在字符串中包含用户名,后跟日期时间戳: GN1RLWFH0546-2020-04-10-18-09-52-563945.txt JOHN-DOE-2020-04-10-1
有人知道为什么我会收到此错误吗?这显示将我的项目升级到新版本的Unity3d之后。 Error CS0103: The name `Array' does not exist in the curre
由于 Embarcadero 的 NNTP 服务器从昨天开始就停止响应,我想我可以在这里问:我使用非数据库感知网格,我需要循环遍历数据集以提取列数、它们的名称、数量行数以及每行中每个字段的值。 我知道
在构建Android应用程序的子项目中,我试图根据根build.gradle中的变量设置版本代码/名称。 子项目build.gradle: apply plugin: 'com.android.app
示例用例: 我有一个带有属性“myProperty”的对象,具有 getter 和 setter(自 EcmaScript 5 起支持“Property Getters 和 Setters”:http
我是一名优秀的程序员,十分优秀!