{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\n 他一共做了两道题,一道是签到题,另一道也是签到题。\n\u003c/div\u003e \n\u003cdiv\u003e \n \u003cbr\u003e 作为一名被队友耻笑为混子选手的ACMer,小阿姆斯特朗(Xiaoarmstrong,1995-)早已厌倦了这样的生活。\n \u003cbr\u003e 于是,他决定继续研究阿姆斯特朗回旋加速喷气式阿姆斯特朗加密算法。\n \u003cbr\u003e \n \u003cbr\u003e 他发现,原来在进行加密之前,需要将文本按照“阿姆斯特朗回旋加速喷气式阿姆斯特朗分段式格式”进行格式化,\n \u003cbr\u003e 格式化后需要计算这个格式化后文本的“格式码”,以用于后面的加密过程,在阿姆斯特朗留下的手稿中,\n \u003cbr\u003e 小阿姆斯特朗找的了这个“格式码”的计算公式:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp; 格式码 \u003d ( \n \u003cspan\u003e\u003cspan\u003e前缀长度\u003c/span\u003e\u003c/span\u003e + \n \u003cspan\u003e\u003cspan\u003e后缀长度\u003c/span\u003e\u003c/span\u003e + \n \u003cspan\u003e\u003cspan\u003e所有\u003c/span\u003e\u003c/span\u003e\" \n \u003cspan\u003e\u003cspan\u003e阿姆斯特朗段\u003c/span\u003e\u003c/span\u003e\"长度和) - 2*( \n \u003cspan\u003e\u003cspan\u003e文本长度\u003c/span\u003e\u003c/span\u003e)\n \u003cbr\u003e \n \u003cbr\u003e \n \u003cspan\u003e\u003cspan\u003e定义\u003c/span\u003e\u003c/span\u003e - \n \u003cspan\u003e\u003cspan\u003e阿姆斯特朗段\u003c/span\u003e\u003c/span\u003e:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp; 是一段连续的字符串。这个字符串包含一个字母\u0027a\u0027(小写),以及\u0027a\u0027前面和后面所有非\u0027a\u0027的字符。\n \u003cbr\u003e \n \u003cbr\u003e \n \u003cspan\u003e\u003cspan\u003e定义\u003c/span\u003e\u003c/span\u003e - 前缀:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp; 是一段连续的字符串,可以为空。这个字符串为格式化文本的最 前 \n \u003cspan\u003e\u003cspan\u003e面不含\u0027a\u0027的串。\u003c/span\u003e\u003c/span\u003e\n \u003cbr\u003e \n \u003cbr\u003e \n \u003cspan\u003e\u003cspan\u003e定义\u003c/span\u003e\u003c/span\u003e - 后缀:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp; 是一段连续的字符串,可以为空。这个字符串为格式化文本的最 后 \n \u003cspan\u003e面不含\u0027a\u0027的串。\u003c/span\u003e\n \u003cbr\u003e \n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp; 例如:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \n \u003cspan\u003e格式化后的文本:\u003c/span\u003e\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \n \u003cspan\u003eqqqabbbappaa\u003c/span\u003e \n \u003cspan\u003e(长度为\u003c/span\u003e \n \u003cspan\u003e12)\u003c/span\u003e\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \n \u003cspan\u003e那么这段文本中包含\u003c/span\u003e 4 \n \u003cspan\u003e个“阿姆斯特朗段”\u003c/span\u003e:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \n \u003cspan\u003eqqqabbb\u003c/span\u003e, \n \u003cspan\u003ebbbapp\u003c/span\u003e, \n \u003cspan\u003eppa\u003c/span\u003e,a\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 前缀:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \n \u003cspan\u003eqqq\u003c/span\u003e\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 后缀:\n \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \n \u003cspan\u003e(无\u003c/span\u003e, 长度为 \n \u003cspan\u003e0)\u003c/span\u003e\n \u003cbr\u003e \n \u003cbr\u003e \n \u003cbr\u003e 现在,小阿姆斯特朗有一段已经格式化的文本进行了阿姆斯特朗回旋加速喷气式阿姆斯特朗加密的第一步,\n \u003cbr\u003e 他想要进行第二步就必须计算这段文本的格式码,请你写一个程序帮他计算格式码。\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e \u003cspan\u003e\u003cspan\u003e输入包含多组测试数据。\u003c/span\u003e\u003c/span\u003e\u003cbr\u003e \u003cspan\u003e\u003cspan\u003e对于每组测试数据,\u003c/span\u003e\u003c/span\u003e\u003cbr\u003e \u003cspan\u003e\u003cspan\u003e第一个数字为正整数N\u003c/span\u003e\u003c/span\u003e (1 ≤ N ≤ 100)\u003cbr\u003e 后面跟随N个数字作为阿姆斯特朗回旋加速喷气式阿姆斯特朗加密第一步后的数据。\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e \u003cspan\u003e输出一行,包含一个整数表示格式码的绝对值。\u003c/span\u003e\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n2\r\n1684234849 1751606885\r\n3\r\n97 24929 100\r\n\r\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n1\r\n3\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e 关于阿姆斯特朗回旋加速喷气式阿姆斯特朗加密算法的第一步:\u003cbr\u003e 该算法首先读入一段文本,该文本的每个字符仅占1字节,直到结束。\u003cbr\u003e 然后,该算法会将连续的每4个字节的二进制位按逆序连接,凑成一个整数,并在末尾加0。例如:\u003cbr\u003e 读入:\u003cbr\u003e \u003cspan\u003eabcdefgh\u003c/span\u003e\u003cbr\u003e \u003cspan\u003e(二进制:01100001\u003c/span\u003e(a) 01100010(b) 01100011(c) 01100100(d) 01100101(e) 01100110(f) 01100111(g) 01101000(h))\u003cbr\u003e 转换后:\u003cbr\u003e 1684234849 1751606885 0(注意输入数据不包含这个末尾的0)\u003cbr\u003e (二进制:01100100011000110110001001100001 01101000011001110110011001100101 0)\u003cbr\u003e (01100100(d)01100011(c)01100010(b)01100001(a) 01101000(h)01100111(g)01100110(f)01100101(e) 0)\u003c/p\u003e"}}]}