The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: CastError
Message: Couldn't cast
text: string
tokens: int64
score: halffloat
score_float: halffloat
-- schema metadata --
pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 526
to
{'text': Value('string')}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1404, in compute_config_parquet_and_info_response
fill_builder_info(builder, hf_endpoint=hf_endpoint, hf_token=hf_token, validate=validate)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 577, in fill_builder_info
) = retry_validate_get_features_num_examples_size_and_compression_ratio(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 496, in retry_validate_get_features_num_examples_size_and_compression_ratio
validate(pf)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 534, in validate
raise TooBigRowGroupsError(
worker.job_runners.config.parquet_and_info.TooBigRowGroupsError: Parquet file has too big row groups. First row group has 409079573 which exceeds the limit of 300000000
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 1815, in _prepare_split_single
for _, table in generator:
^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 691, in wrapped
for item in generator(*args, **kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/packaged_modules/parquet/parquet.py", line 106, in _generate_tables
yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/packaged_modules/parquet/parquet.py", line 73, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/table.py", line 2272, in table_cast
return cast_table_to_schema(table, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/table.py", line 2218, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
text: string
tokens: int64
score: halffloat
score_float: halffloat
-- schema metadata --
pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 526
to
{'text': Value('string')}
because column names don't match
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1427, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 993, in stream_convert_to_parquet
builder._prepare_split(
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 1702, in _prepare_split
for job_id, done, content in self._prepare_split_single(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 1858, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string |
|---|
# 2 SHA1和MD5的算法说明
SHA1和MD5的算法都是从MD4算法改进而来的2种算法,基本思路都是将信息分成N个分组,每组64个字节,每个分组都进行摘要运算。当一个分组的摘要运算完毕后,将上一个分组的结果也用于下一个分组的运算。
MD5最后生成的摘要信息是16个字节,SHA1是20个字节。
MD5和SHA1的分组信息运算,分组里面的的数据都会被视为16个DWORD,而MD5算法认为这些DWORD的字节序列是LITTLE-ENDIAN,而SHA1的算法认为DWORD是BIG-ENDIAN的。所以在不同字节序的主机上要进行转换。
61 62 63 80 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00
61 62 63 80 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18
31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36
37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32
33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38
39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34
35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30
80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 80 02 00 00 00 00 00 00
# 3 上源码
1 #include <stdio.h>
2 #include <stdint.h>
3 #include <string.h>
4 #include <assert.h>
5
6 //字节序的小头和大头的问题
7 #define ZEN_LITTLE_ENDIAN 0x0123
8 #define ZEN_BIG_ENDIAN 0x3210
9
10 //目前所有的代码都是为了小头党服务的,不知道有生之年这套代码是否还会为大头党服务一次?
11 #ifndef ZEN_BYTES_ORDER
12 #define ZEN_BYTES_ORDER ZEN_LITTLE_ENDIAN
13 #endif
14
15 #ifndef ZEN_SWAP_UINT16
16 #define ZEN_SWAP_UINT16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
17 #endif
18 #ifndef ZEN_SWAP_UINT32
19 #define ZEN_SWAP_UINT32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
20 (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
21 #endif
22 #ifndef ZEN_SWAP_UINT64
23 #define ZEN_SWAP_UINT64(x) ((((x) & 0xff00000000000000) >> 56) | (((x) & 0x00ff000000000000) >> 40) | \
24 (((x) & 0x0000ff0000000000) >> 24) | (((x) & 0x000000ff00000000) >> 8) | \
25 (((x) & 0x00000000ff000000) << 8 ) | (((x) & 0x0000000000ff0000) << 24) | \
26 (((x) & 0x000000000000ff00) << 40 ) | (((x) & 0x00000000000000ff) << 56))
27 #endif
28
29 //将一个(字符串)数组,拷贝到另外一个uint32_t数组,同时每个uint32_t反字节序
30 void *swap_uint32_memcpy(void *to, const void *from, size_t length)
31 {
32 memcpy(to, from, length);
33 size_t remain_len = (4 - (length & 3)) & 3;
34
35 //数据不是4字节的倍数,补充0
36 if (remain_len)
37 {
38 for (size_t i = 0; i < remain_len; ++i)
39 {
40 *((char *)(to) + length + i) = 0;
41 }
42 //调整成4的倍数
43 length += remain_len;
44 }
45
46 //所有的数据反转
47 for (size_t i = 0; i < length / 4; ++i)
48 {
49 ((uint32_t *)to)[i] = ZEN_SWAP_UINT32(((uint32_t *)to)[i]);
50 }
51
53 }
54
55 ///MD5的结果数据长度
56 static const size_t ZEN_MD5_HASH_SIZE = 16;
57 ///SHA1的结果数据长度
58 static const size_t ZEN_SHA1_HASH_SIZE = 20;
59
60
61
62 namespace ZEN_LIB
63 {
64
65
66 /*!
67 @brief 求某个内存块的MD5,
68 @return unsigned char* 返回的的结果,
69 @param[in] buf 求MD5的内存BUFFER指针
70 @param[in] size BUFFER长度
71 @param[out] result 结果
72 */
73 unsigned char *md5(const unsigned char *buf,
74 size_t size,
75 unsigned char result[ZEN_MD5_HASH_SIZE]);
76
77
78 /*!
79 @brief 求内存块BUFFER的SHA1值
80 @return unsigned char* 返回的的结果
81 @param[in] buf 求SHA1的内存BUFFER指针
82 @param[in] size BUFFER长度
83 @param[out] result 结果
84 */
85 unsigned char *sha1(const unsigned char *buf,
86 size_t size,
87 unsigned char result[ZEN_SHA1_HASH_SIZE]);
88 };
89
90
91 //================================================================================================
92 //MD5的算法
93
94 //每次处理的BLOCK的大小
95 static const size_t ZEN_MD5_BLOCK_SIZE = 64;
96
97 //md5算法的上下文,保存一些状态,中间数据,结果
98 typedef struct md5_ctx
99 {
100 //处理的数据的长度
101 uint64_t length_;
102 //还没有处理的数据长度
103 uint64_t unprocessed_;
104 //取得的HASH结果(中间数据)
105 uint32_t hash_[4];
106 } md5_ctx;
107
108
109 #define ROTL32(dword, n) ((dword) << (n) ^ ((dword) >> (32 - (n))))
110 #define ROTR32(dword, n) ((dword) >> (n) ^ ((dword) << (32 - (n))))
111 #define ROTL64(qword, n) ((qword) << (n) ^ ((qword) >> (64 - (n))))
112 #define ROTR64(qword, n) ((qword) >> (n) ^ ((qword) << (64 - (n))))
113
114
115 /*!
116 @brief 内部函数,初始化MD5的context,内容
117 @param ctx
118 */
119 static void zen_md5_init(md5_ctx *ctx)
120 {
121 ctx->length_ = 0;
122 ctx->unprocessed_ = 0;
123
124 /* initialize state */
125 ctx->hash_[0] = 0x67452301;
126 ctx->hash_[1] = 0xefcdab89;
128 ctx->hash_[3] = 0x10325476;
129 }
130
131 /* First, define four auxiliary functions that each take as input
132 * three 32-bit words and returns a 32-bit word.*/
133
134 /* F(x,y,z) = ((y XOR z) AND x) XOR z - is faster then original version */
135 #define MD5_F(x, y, z) ((((y) ^ (z)) & (x)) ^ (z))
136 #define MD5_G(x, y, z) (((x) & (z)) | ((y) & (~z)))
137 #define MD5_H(x, y, z) ((x) ^ (y) ^ (z))
138 #define MD5_I(x, y, z) ((y) ^ ((x) | (~z)))
139
140 /* transformations for rounds 1, 2, 3, and 4. */
141 #define MD5_ROUND1(a, b, c, d, x, s, ac) { \
142 (a) += MD5_F((b), (c), (d)) + (x) + (ac); \
143 (a) = ROTL32((a), (s)); \
144 (a) += (b); \
145 }
146 #define MD5_ROUND2(a, b, c, d, x, s, ac) { \
147 (a) += MD5_G((b), (c), (d)) + (x) + (ac); \
148 (a) = ROTL32((a), (s)); \
149 (a) += (b); \
150 }
151 #define MD5_ROUND3(a, b, c, d, x, s, ac) { \
152 (a) += MD5_H((b), (c), (d)) + (x) + (ac); \
153 (a) = ROTL32((a), (s)); \
154 (a) += (b); \
155 }
156 #define MD5_ROUND4(a, b, c, d, x, s, ac) { \
157 (a) += MD5_I((b), (c), (d)) + (x) + (ac); \
158 (a) = ROTL32((a), (s)); \
159 (a) += (b); \
160 }
161
162
163 /*!
164 @brief 内部函数,将64个字节,16个uint32_t的数组进行摘要(杂凑)处理,处理的数据自己序是小头数据
165 @param state 存放处理的hash数据结果
166 @param block 要处理的block,64个字节,16个uint32_t的数组
167 */
168 static void zen_md5_process_block(uint32_t state[4], const uint32_t block[ZEN_MD5_BLOCK_SIZE / 4])
169 {
170 register unsigned a, b, c, d;
171 a = state[0];
172 b = state[1];
173 c = state[2];
174 d = state[3];
175
176 const uint32_t *x = NULL;
177
178 //MD5里面计算的数据都是小头数据.大头党的数据要处理
179 #if ZEN_BYTES_ORDER == ZEN_LITTLE_ENDIAN
180 x = block;
181 #else
182 uint32_t swap_block[ZEN_MD5_BLOCK_SIZE / 4];
183 swap_uint32_memcpy(swap_block, block, 64);
184 x = swap_block;
185 #endif
186
187
188 MD5_ROUND1(a, b, c, d, x[ 0], 7, 0xd76aa478);
189 MD5_ROUND1(d, a, b, c, x[ 1], 12, 0xe8c7b756);
190 MD5_ROUND1(c, d, a, b, x[ 2], 17, 0x242070db);
191 MD5_ROUND1(b, c, d, a, x[ 3], 22, 0xc1bdceee);
192 MD5_ROUND1(a, b, c, d, x[ 4], 7, 0xf57c0faf);
193 MD5_ROUND1(d, a, b, c, x[ 5], 12, 0x4787c62a);
194 MD5_ROUND1(c, d, a, b, x[ 6], 17, 0xa8304613);
195 MD5_ROUND1(b, c, d, a, x[ 7], 22, 0xfd469501);
196 MD5_ROUND1(a, b, c, d, x[ 8], 7, 0x698098d8);
197 MD5_ROUND1(d, a, b, c, x[ 9], 12, 0x8b44f7af);
198 MD5_ROUND1(c, d, a, b, x[10], 17, 0xffff5bb1);
199 MD5_ROUND1(b, c, d, a, x[11], 22, 0x895cd7be);
200 MD5_ROUND1(a, b, c, d, x[12], 7, 0x6b901122);
201 MD5_ROUND1(d, a, b, c, x[13], 12, 0xfd987193);
202 MD5_ROUND1(c, d, a, b, x[14], 17, 0xa679438e);
203 MD5_ROUND1(b, c, d, a, x[15], 22, 0x49b40821);
204
205 MD5_ROUND2(a, b, c, d, x[ 1], 5, 0xf61e2562);
206 MD5_ROUND2(d, a, b, c, x[ 6], 9, 0xc040b340);
207 MD5_ROUND2(c, d, a, b, x[11], 14, 0x265e5a51);
208 MD5_ROUND2(b, c, d, a, x[ 0], 20, 0xe9b6c7aa);
209 MD5_ROUND2(a, b, c, d, x[ 5], 5, 0xd62f105d);
210 MD5_ROUND2(d, a, b, c, x[10], 9, 0x2441453);
211 MD5_ROUND2(c, d, a, b, x[15], 14, 0xd8a1e681);
212 MD5_ROUND2(b, c, d, a, x[ 4], 20, 0xe7d3fbc8);
213 MD5_ROUND2(a, b, c, d, x[ 9], 5, 0x21e1cde6);
214 MD5_ROUND2(d, a, b, c, x[14], 9, 0xc33707d6);
215 MD5_ROUND2(c, d, a, b, x[ 3], 14, 0xf4d50d87);
216 MD5_ROUND2(b, c, d, a, x[ 8], 20, 0x455a14ed);
217 MD5_ROUND2(a, b, c, d, x[13], 5, 0xa9e3e905);
218 MD5_ROUND2(d, a, b, c, x[ 2], 9, 0xfcefa3f8);
219 MD5_ROUND2(c, d, a, b, x[ 7], 14, 0x676f02d9);
220 MD5_ROUND2(b, c, d, a, x[12], 20, 0x8d2a4c8a);
221
222 MD5_ROUND3(a, b, c, d, x[ 5], 4, 0xfffa3942);
223 MD5_ROUND3(d, a, b, c, x[ 8], 11, 0x8771f681);
224 MD5_ROUND3(c, d, a, b, x[11], 16, 0x6d9d6122);
225 MD5_ROUND3(b, c, d, a, x[14], 23, 0xfde5380c);
226 MD5_ROUND3(a, b, c, d, x[ 1], 4, 0xa4beea44);
227 MD5_ROUND3(d, a, b, c, x[ 4], 11, 0x4bdecfa9);
228 MD5_ROUND3(c, d, a, b, x[ 7], 16, 0xf6bb4b60);
229 MD5_ROUND3(b, c, d, a, x[10], 23, 0xbebfbc70);
230 MD5_ROUND3(a, b, c, d, x[13], 4, 0x289b7ec6);
231 MD5_ROUND3(d, a, b, c, x[ 0], 11, 0xeaa127fa);
232 MD5_ROUND3(c, d, a, b, x[ 3], 16, 0xd4ef3085);
233 MD5_ROUND3(b, c, d, a, x[ 6], 23, 0x4881d05);
234 MD5_ROUND3(a, b, c, d, x[ 9], 4, 0xd9d4d039);
235 MD5_ROUND3(d, a, b, c, x[12], 11, 0xe6db99e5);
236 MD5_ROUND3(c, d, a, b, x[15], 16, 0x1fa27cf8);
237 MD5_ROUND3(b, c, d, a, x[ 2], 23, 0xc4ac5665);
238
239 MD5_ROUND4(a, b, c, d, x[ 0], 6, 0xf4292244);
240 MD5_ROUND4(d, a, b, c, x[ 7], 10, 0x432aff97);
241 MD5_ROUND4(c, d, a, b, x[14], 15, 0xab9423a7);
242 MD5_ROUND4(b, c, d, a, x[ 5], 21, 0xfc93a039);
243 MD5_ROUND4(a, b, c, d, x[12], 6, 0x655b59c3);
244 MD5_ROUND4(d, a, b, c, x[ 3], 10, 0x8f0ccc92);
245 MD5_ROUND4(c, d, a, b, x[10], 15, 0xffeff47d);
246 MD5_ROUND4(b, c, d, a, x[ 1], 21, 0x85845dd1);
247 MD5_ROUND4(a, b, c, d, x[ 8], 6, 0x6fa87e4f);
248 MD5_ROUND4(d, a, b, c, x[15], 10, 0xfe2ce6e0);
249 MD5_ROUND4(c, d, a, b, x[ 6], 15, 0xa3014314);
250 MD5_ROUND4(b, c, d, a, x[13], 21, 0x4e0811a1);
251 MD5_ROUND4(a, b, c, d, x[ 4], 6, 0xf7537e82);
252 MD5_ROUND4(d, a, b, c, x[11], 10, 0xbd3af235);
253 MD5_ROUND4(c, d, a, b, x[ 2], 15, 0x2ad7d2bb);
254 MD5_ROUND4(b, c, d, a, x[ 9], 21, 0xeb86d391);
255
256 state[0] += a;
257 state[1] += b;
258 state[2] += c;
259 state[3] += d;
260 }
261
262
263 /*!
264 @brief 内部函数,处理数据的前面部分(>64字节的部分),每次组成一个64字节的block就进行杂凑处理
265 @param[out] ctx 算法的context,用于记录一些处理的上下文和结果
266 @param[in] buf 处理的数据,
267 @param[in] size 处理的数据长度
268 */
269 static void zen_md5_update(md5_ctx *ctx, const unsigned char *buf, size_t size)
270 {
271 //为什么不是=,因为在某些环境下,可以多次调用zen_md5_update,但这种情况,必须保证前面的调用,每次都没有unprocessed_
272 ctx->length_ += size;
273
274 //每个处理的块都是64字节
275 while (size >= ZEN_MD5_BLOCK_SIZE)
276 {
277 zen_md5_process_block(ctx->hash_, reinterpret_cast<const uint32_t *>(buf));
278 buf += ZEN_MD5_BLOCK_SIZE;
279 size -= ZEN_MD5_BLOCK_SIZE;
280 }
281
282 ctx->unprocessed_ = size;
283 }
284
285
286 /*!
287 @brief 内部函数,处理数据的末尾部分,我们要拼出最后1个(或者两个)要处理的BLOCK,加上0x80,加上长度进行处理
288 @param[in] ctx 算法的context,用于记录一些处理的上下文和结果
289 @param[in] buf 处理的数据
290 @param[in] size 处理buffer的长度
291 @param[out] result 返回的结果,
292 */
293 static void zen_md5_final(md5_ctx *ctx, const unsigned char *buf, size_t size, unsigned char *result)
294 {
295 uint32_t message[ZEN_MD5_BLOCK_SIZE / 4];
296
297 //保存剩余的数据,我们要拼出最后1个(或者两个)要处理的块,前面的算法保证了,最后一个块肯定小于64个字节
298 if (ctx->unprocessed_)
299 {
300 memcpy(message, buf + size - ctx->unprocessed_, static_cast<size_t>( ctx->unprocessed_));
301 }
302
303 //得到0x80要添加在的位置(在uint32_t 数组中),
304 uint32_t index = ((uint32_t)ctx->length_ & 63) >> 2;
305 uint32_t shift = ((uint32_t)ctx->length_ & 3) * 8;
306
307 //添加0x80进去,并且把余下的空间补充0
308 message[index] &= ~(0xFFFFFFFF << shift);
309 message[index++] ^= 0x80 << shift;
310
311 //如果这个block还无法处理,其后面的长度无法容纳长度64bit,那么先处理这个block
312 if (index > 14)
313 {
314 while (index < 16)
315 {
316 message[index++] = 0;
317 }
318
319 zen_md5_process_block(ctx->hash_, message);
320 index = 0;
321 }
322
323 //补0
324 while (index < 14)
325 {
326 message[index++] = 0;
327 }
328
329 //保存长度,注意是bit位的长度,这个问题让我看着郁闷了半天,
330 uint64_t data_len = (ctx->length_) << 3;
331
332 //注意MD5算法要求的64bit的长度是小头LITTLE-ENDIAN编码,注意下面的比较是!=
333 #if ZEN_BYTES_ORDER != ZEN_LITTLE_ENDIAN
334 data_len = ZEN_SWAP_UINT64(data_len);
335 #endif
336
337 message[14] = (uint32_t) (data_len & 0x00000000FFFFFFFF);
338 message[15] = (uint32_t) ((data_len & 0xFFFFFFFF00000000ULL) >> 32);
339
340 zen_md5_process_block(ctx->hash_, message);
341
342 //注意结果是小头党的,在大头的世界要进行转换
343 #if ZEN_BYTES_ORDER == ZEN_LITTLE_ENDIAN
344 memcpy(result, &ctx->hash_, ZEN_MD5_HASH_SIZE);
345 #else
346 swap_uint32_memcpy(result, &ctx->hash_, ZEN_MD5_HASH_SIZE);
347 #endif
348
349 }
350
351
352 //计算一个内存数据的MD5值
353 unsigned char *ZEN_LIB::md5(const unsigned char *buf,
354 size_t size,
355 unsigned char result[ZEN_MD5_HASH_SIZE])
356 {
357 assert(result != NULL);
358
359 md5_ctx ctx;
360 zen_md5_init(&ctx);
361 zen_md5_update(&ctx, buf, size);
362 zen_md5_final(&ctx, buf, size, result);
363 return result;
364 }
365
366
367
368
369 //================================================================================================
370 //SHA1的算法
371
372 //每次处理的BLOCK的大小
373 static const size_t ZEN_SHA1_BLOCK_SIZE = 64;
374
375 //SHA1算法的上下文,保存一些状态,中间数据,结果
376 typedef struct sha1_ctx
377 {
378
379 //处理的数据的长度
380 uint64_t length_;
381 //还没有处理的数据长度
382 uint64_t unprocessed_;
383 /* 160-bit algorithm internal hashing state */
384 uint32_t hash_[5];
385 } sha1_ctx;
386
387 //内部函数,SHA1算法的上下文的初始化
388 static void zen_sha1_init(sha1_ctx *ctx)
389 {
390 ctx->length_ = 0;
391 ctx->unprocessed_ = 0;
392 // 初始化算法的几个常量,魔术数
393 ctx->hash_[0] = 0x67452301;
394 ctx->hash_[1] = 0xefcdab89;
396 ctx->hash_[3] = 0x10325476;
397 ctx->hash_[4] = 0xc3d2e1f0;
398 }
399
400
401 /*!
402 @brief 内部函数,对一个64bit内存块进行摘要(杂凑)处理,
403 @param hash 存放计算hash结果的的数组
404 @param block 要计算的处理得内存块
405 */
406 static void zen_sha1_process_block(uint32_t hash[5],
407 const uint32_t block[ZEN_SHA1_BLOCK_SIZE / 4])
408 {
409 size_t t;
410 uint32_t wblock[80];
411 register uint32_t a, b, c, d, e, temp;
412
413 //SHA1算法处理的内部数据要求是大头党的,在小头的环境转换
414 #if ZEN_BYTES_ORDER == ZEN_LITTLE_ENDIAN
415 swap_uint32_memcpy(wblock, block, ZEN_SHA1_BLOCK_SIZE);
416 #else
417 ::memcpy(wblock, block, ZEN_SHA1_BLOCK_SIZE);
418 #endif
419
420 //处理
421 for (t = 16; t < 80; t++)
422 {
423 wblock[t] = ROTL32(wblock[t - 3] ^ wblock[t - 8] ^ wblock[t - 14] ^ wblock[t - 16], 1);
424 }
425
426 a = hash[0];
427 b = hash[1];
428 c = hash[2];
429 d = hash[3];
430 e = hash[4];
431
432 for (t = 0; t < 20; t++)
433 {
434 /* the following is faster than ((B & C) | ((~B) & D)) */
435 temp = ROTL32(a, 5) + (((c ^ d) & b) ^ d)
436 + e + wblock[t] + 0x5A827999;
437 e = d;
438 d = c;
439 c = ROTL32(b, 30);
440 b = a;
441 a = temp;
442 }
443
444 for (t = 20; t < 40; t++)
445 {
446 temp = ROTL32(a, 5) + (b ^ c ^ d) + e + wblock[t] + 0x6ED9EBA1;
447 e = d;
448 d = c;
449 c = ROTL32(b, 30);
450 b = a;
451 a = temp;
452 }
453
454 for (t = 40; t < 60; t++)
455 {
456 temp = ROTL32(a, 5) + ((b & c) | (b & d) | (c & d))
457 + e + wblock[t] + 0x8F1BBCDC;
458 e = d;
459 d = c;
460 c = ROTL32(b, 30);
461 b = a;
462 a = temp;
463 }
464
465 for (t = 60; t < 80; t++)
466 {
467 temp = ROTL32(a, 5) + (b ^ c ^ d) + e + wblock[t] + 0xCA62C1D6;
468 e = d;
469 d = c;
470 c = ROTL32(b, 30);
471 b = a;
472 a = temp;
473 }
474
475 hash[0] += a;
476 hash[1] += b;
477 hash[2] += c;
478 hash[3] += d;
479 hash[4] += e;
480 }
481
482
483 /*!
484 @brief 内部函数,处理数据的前面部分(>64字节的部分),每次组成一个64字节的block就进行杂凑处理
485 @param ctx 算法的上下文,记录中间数据,结果等
486 @param msg 要进行计算的数据buffer
487 @param size 长度
488 */
489 static void zen_sha1_update(sha1_ctx *ctx,
490 const unsigned char *buf,
491 size_t size)
492 {
493 //为了让zen_sha1_update可以多次进入,长度可以累计
494 ctx->length_ += size;
495
496 //每个处理的块都是64字节
497 while (size >= ZEN_SHA1_BLOCK_SIZE)
498 {
499 zen_sha1_process_block(ctx->hash_, reinterpret_cast<const uint32_t *>(buf));
500 buf += ZEN_SHA1_BLOCK_SIZE;
501 size -= ZEN_SHA1_BLOCK_SIZE;
502 }
503
504 ctx->unprocessed_ = size;
505 }
506
507
508 /*!
509 @brief 内部函数,处理数据的最后部分,添加0x80,补0,增加长度信息
510 @param ctx 算法的上下文,记录中间数据,结果等
511 @param msg 要进行计算的数据buffer
512 @param result 返回的结果
513 */
514 static void zen_sha1_final(sha1_ctx *ctx,
515 const unsigned char *msg,
516 size_t size,
517 unsigned char *result)
518 {
519
520 uint32_t message[ZEN_SHA1_BLOCK_SIZE / 4];
521
522 //保存剩余的数据,我们要拼出最后1个(或者两个)要处理的块,前面的算法保证了,最后一个块肯定小于64个字节
523 if (ctx->unprocessed_)
524 {
525 memcpy(message, msg + size - ctx->unprocessed_, static_cast<size_t>( ctx->unprocessed_));
526 }
527
528 //得到0x80要添加在的位置(在uint32_t 数组中),
529 uint32_t index = ((uint32_t)ctx->length_ & 63) >> 2;
530 uint32_t shift = ((uint32_t)ctx->length_ & 3) * 8;
531
532 //添加0x80进去,并且把余下的空间补充0
533 message[index] &= ~(0xFFFFFFFF << shift);
534 message[index++] ^= 0x80 << shift;
535
536 //如果这个block还无法处理,其后面的长度无法容纳长度64bit,那么先处理这个block
537 if (index > 14)
538 {
539 while (index < 16)
540 {
541 message[index++] = 0;
542 }
543
544 zen_sha1_process_block(ctx->hash_, message);
545 index = 0;
546 }
547
548 //补0
549 while (index < 14)
550 {
551 message[index++] = 0;
552 }
553
554 //保存长度,注意是bit位的长度,这个问题让我看着郁闷了半天,
555 uint64_t data_len = (ctx->length_) << 3;
556
557 //注意SHA1算法要求的64bit的长度是大头BIG-ENDIAN,在小头的世界要进行转换
558 #if ZEN_BYTES_ORDER == ZEN_LITTLE_ENDIAN
559 data_len = ZEN_SWAP_UINT64(data_len);
560 #endif
561
562 message[14] = (uint32_t) (data_len & 0x00000000FFFFFFFF);
563 message[15] = (uint32_t) ((data_len & 0xFFFFFFFF00000000ULL) >> 32);
564
565 zen_sha1_process_block(ctx->hash_, message);
566
567 //注意结果是大头党的,在小头的世界要进行转换
568 #if ZEN_BYTES_ORDER == ZEN_LITTLE_ENDIAN
569 swap_uint32_memcpy(result, &ctx->hash_, ZEN_SHA1_HASH_SIZE);
570 #else
571 memcpy(result, &ctx->hash_, ZEN_SHA1_HASH_SIZE);
572 #endif
573 }
574
575
576
577 //计算一个内存数据的SHA1值
578 unsigned char *ZEN_LIB::sha1(const unsigned char *msg,
579 size_t size,
580 unsigned char result[ZEN_SHA1_HASH_SIZE])
581 {
582 assert(result != NULL);
583
584 sha1_ctx ctx;
585 zen_sha1_init(&ctx);
586 zen_sha1_update(&ctx, msg, size);
587 zen_sha1_final(&ctx, msg, size, result);
588 return result;
589 }
590
591 int main(int /*argc*/, char * /*argv*/[])
592 {
593
594 int ret = 0;
595 static unsigned char test_buf[7][81] =
596 {
597 { "" },
598 { "a" },
599 { "abc" },
600 { "message digest" },
601 { "abcdefghijklmnopqrstuvwxyz" },
602 { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
603 { "12345678901234567890123456789012345678901234567890123456789012345678901234567890" }
604 };
605
606 static const size_t test_buflen[7] =
607 {
608 0, 1, 3, 14, 26, 62, 80
609 };
610
611 static const unsigned char md5_test_sum[7][16] =
612 {
613 { 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04, 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E },
614 { 0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8, 0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61 },
615 { 0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0, 0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72 },
616 { 0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D, 0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0 },
617 { 0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00, 0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B },
618 { 0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5, 0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F },
619 { 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55, 0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A }
620 };
621 unsigned char result[32] ={0};
622
623 for(size_t i=0;i<7;++i)
624 {
625 ZEN_LIB::md5(test_buf[i],test_buflen[i],result);
626 ret = memcmp(result,md5_test_sum[i],16);
627 if (ret != 0)
628 {
629 assert(false);
630 }
631 }
632
633 static const unsigned char sha1_test_sum[7][20] =
634 {
635 { 0xda,0x39,0xa3,0xee,0x5e,0x6b,0x4b,0x0d,0x32,0x55,0xbf,0xef,0x95,0x60,0x18,0x90,0xaf,0xd8,0x07,0x09 },
636 { 0x86,0xf7,0xe4,0x37,0xfa,0xa5,0xa7,0xfc,0xe1,0x5d,0x1d,0xdc,0xb9,0xea,0xea,0xea,0x37,0x76,0x67,0xb8 },
637 { 0xa9,0x99,0x3e,0x36,0x47,0x06,0x81,0x6a,0xba,0x3e,0x25,0x71,0x78,0x50,0xc2,0x6c,0x9c,0xd0,0xd8,0x9d },
638 { 0xc1,0x22,0x52,0xce,0xda,0x8b,0xe8,0x99,0x4d,0x5f,0xa0,0x29,0x0a,0x47,0x23,0x1c,0x1d,0x16,0xaa,0xe3 },
639 { 0x32,0xd1,0x0c,0x7b,0x8c,0xf9,0x65,0x70,0xca,0x04,0xce,0x37,0xf2,0xa1,0x9d,0x84,0x24,0x0d,0x3a,0x89 },
640 { 0x76,0x1c,0x45,0x7b,0xf7,0x3b,0x14,0xd2,0x7e,0x9e,0x92,0x65,0xc4,0x6f,0x4b,0x4d,0xda,0x11,0xf9,0x40 },
641 { 0x50,0xab,0xf5,0x70,0x6a,0x15,0x09,0x90,0xa0,0x8b,0x2c,0x5e,0xa4,0x0f,0xa0,0xe5,0x85,0x55,0x47,0x32 },
642 };
643 for(size_t i=0;i<7;++i)
644 {
645 ZEN_LIB::sha1(test_buf[i],test_buflen[i],result);
646 ret = memcmp(result,sha1_test_sum[i],20);
647 if (ret != 0)
648 {
649 assert(false);
650 }
651 }
652 return 0;
653 }
rhashlib采用的协议是MIT,在此再次感谢原来的作者,另外维基上面的伪代码帮助非常大。
【本文作者是雁渡寒潭,本着自由的精神,你可以在无盈利的情况完整转载此文 档,转载时请附上BLOG链接:http://www.cnblogs.com/fullsail/,否则每字一元,每图一百不讲价。对Baidu文库和360doc加价一倍】
posted @ 2013-02-22 03:12 fullsail 阅读(...) 评论(...) 编辑 收藏
|
• 这是一套导购月报表汇总表excel模版下载,喜欢的人都来下载吧。该文档为导购月报表汇总表excel模版下载,是一份很不错的参考资料,具有较高参考价值,感兴趣的可以下载看看
• //佣金净收入 desSalary.setSalYxtc(oriSalary.getSalYxtc()+(desSalary.getSalYxtc()==null?0:desSalary.getSalYxtc())); desSalary.setSalJbgzBefore(oriSalary.getSalJbgzBefore()+(desSalary....
参考代码
public List<SalaryDetail> monthFormListFormat(List<SalaryDetail> oriSalaryList) {
//未作任何处理的list
if(oriSalaryList==null||oriSalaryList.size()==0)
return null;
int len = oriSalaryList.size();
//目的List
List<SalaryDetail> desSalaryList = oriSalaryList;
//第一行的对象
SalaryDetail firstLineSalary = oriSalaryList.get(0);
//小计的对象
SalaryDetail subtotalSalary = new SalaryDetail();
//最后总计的对象
SalaryDetail sumtotalSalary = new SalaryDetail();
//存放小计对象的位置,以及小计对象
Map<Integer,SalaryDetail> subtotalMap = new HashMap<Integer,SalaryDetail>();
//插入了几行数据
int n = 0;
for(int i = 0;i<len;i++){
if(firstLineSalary.getUserType().equals(oriSalaryList.get(i).getUserType())) {
if(i==len-1){
subtotalSalary = getSubTotalSum(subtotalSalary, oriSalaryList.get(i),"1");
subtotalSalary.setUserType("小计");
subtotalSalary.setRowSpanCount(1);
subtotalMap.put(i, subtotalSalary);
sumtotalSalary = getSubTotalSum(sumtotalSalary, subtotalSalary,"1");
break;
}
//如果用户类型相同则进行相加,以便得到小计的值
subtotalSalary = getSubTotalSum(subtotalSalary, oriSalaryList.get(i),"1");
}else{
if(i==len-1){
//把最后一条记录以上的计算一下,并清空【小计】
subtotalSalary.setUserType("小计");
subtotalSalary.setRowSpanCount(1);
sumtotalSalary = getSubTotalSum(sumtotalSalary, subtotalSalary,"1");
subtotalMap.put(i-1, subtotalSalary);
subtotalSalary = new SalaryDetail();
//最后一条记录的处理
subtotalSalary = getSubTotalSum(subtotalSalary, oriSalaryList.get(i),"1");
subtotalSalary.setUserType("小计");
subtotalSalary.setRowSpanCount(1);
sumtotalSalary = getSubTotalSum(sumtotalSalary, subtotalSalary,"1");
subtotalMap.put(i, subtotalSalary);
break;
}
//把每种用户类型的第一行修改,并在List副本里面加上一个小计的对象,
firstLineSalary = oriSalaryList.get(i);
subtotalSalary.setUserType("小计");
subtotalSalary.setRowSpanCount(1);
subtotalMap.put(i-1, subtotalSalary);
sumtotalSalary = getSubTotalSum(sumtotalSalary, subtotalSalary,"1");
subtotalSalary = new SalaryDetail();
//把新的“第一个值”增加到小计中
subtotalSalary = getSubTotalSum(subtotalSalary, firstLineSalary,"1");
}
}
for(int i = oriSalaryList.size()-1;i>=0;i--){
if(subtotalMap.containsKey(i)){
// if(i == oriSalaryList.size()-1){
// }else{
// }
}
}
//插入最后一列
sumtotalSalary.setUserType("总计");
sumtotalSalary.setRowSpanCount(1);
//新的第一行
firstLineSalary = oriSalaryList.get(0);
len = oriSalaryList.size();
int rowSpan = 0;
//加上rowspan
for(int i = 0;i<len;i++){
if(i<len-1){
SalaryDetail nextLineSalary = oriSalaryList.get(i+1);
if("小计".equals(nextLineSalary.getUserType())||"总计".equals(nextLineSalary.getUserType())){
if(!"小计".equals(firstLineSalary.getUserType())&&!"总计".equals(firstLineSalary.getUserType())){
firstLineSalary.setRowSpanCount(rowSpan+1);
}
continue;
}
if(firstLineSalary.getUserType().equals(nextLineSalary.getUserType())){
rowSpan ++;
firstLineSalary.setRowSpanCount(rowSpan+1);
}else{
rowSpan = 0;
firstLineSalary = nextLineSalary;
}
}
}
return oriSalaryList;
}
/**
* 把原对象的值和目的对象的值相加,并返回目的对象
* @param desSalary
* @param oriSalary
* @return
*/
private SalaryDetail getSubTotalSum(SalaryDetail desSalary,SalaryDetail oriSalary,String flg){
//desSalary.setUserType("小计");
if("1".equals(flg)){
desSalary.setEleYjdf(oriSalary.getEleYjdf()+(desSalary.getEleYjdf()==null?0:desSalary.getEleYjdf()));
desSalary.setEleJxzxh(oriSalary.getEleJxzxh()+(desSalary.getEleJxzxh()==null?0:desSalary.getEleJxzxh()));
desSalary.setEleHgkjxs(oriSalary.getEleHgkjxs()+(desSalary.getEleHgkjxs()==null?0:desSalary.getEleHgkjxs()));
desSalary.setEleYdkhxs(oriSalary.getEleYdkhxs()+(desSalary.getEleYdkhxs()==null?0:desSalary.getEleYdkhxs()));
desSalary.setEleGlkpxs(oriSalary.getEleGlkpxs()+(desSalary.getEleGlkpxs()==null?0:desSalary.getEleGlkpxs()));//管理考评
//desSalary.setEleTcbl(oriSalary.getEleTcbl()+(desSalary.getEleTcbl()==null?0:desSalary.getEleTcbl()));//提成比例,不需要进行计算
}
if("2".equals(flg)){
//设置虚拟的编号
desSalary.setVid(oriSalary.getVid());
desSalary.setUserCount(oriSalary.getUserCount()+desSalary.getUserCount());
}
desSalary.setEleQmkhzc(oriSalary.getEleQmkhzc()+(desSalary.getEleQmkhzc()==null?0:desSalary.getEleQmkhzc()));//期末客户资产
desSalary.setEleYjfy(oriSalary.getEleYjfy()+(desSalary.getEleYjfy()==null?0:desSalary.getEleYjfy()));//一级费用
desSalary.setEleCjl(oriSalary.getEleCjl()+(desSalary.getEleCjl()==null?0:desSalary.getEleCjl()));
desSalary.setEleSsyj(oriSalary.getEleSsyj()+(desSalary.getEleSsyj()==null?0:desSalary.getEleSsyj()));//实收佣金
desSalary.setEleYysjfj(oriSalary.getEleYysjfj()+(desSalary.getEleYysjfj()==null?0:desSalary.getEleYysjfj()));//营业税及附加
desSalary.setEleTzzbhjj(oriSalary.getEleTzzbhjj()+(desSalary.getEleTzzbhjj()==null?0:desSalary.getEleTzzbhjj()));//投资者保护基金
desSalary.setOthField1(oriSalary.getOthField1()+(desSalary.getOthField1()==null?0:desSalary.getOthField1()));//净佣金
desSalary.setEleYyjjsr(oriSalary.getEleYyjjsr()+(desSalary.getEleYyjjsr()==null?0:desSalary.getEleYyjjsr()));//月佣金净收入
desSalary.setSalYxtc(oriSalary.getSalYxtc()+(desSalary.getSalYxtc()==null?0:desSalary.getSalYxtc()));
desSalary.setSalJbgzBefore(oriSalary.getSalJbgzBefore()+(desSalary.getSalJbgzBefore()==null?0:desSalary.getSalJbgzBefore())); //调整前基本工资
desSalary.setSalJbgz(oriSalary.getSalJbgz()+(desSalary.getSalJbgz()==null?0:desSalary.getSalJbgz()));
desSalary.setSalGljt(oriSalary.getSalGljt()+(desSalary.getSalGljt()==null?0:desSalary.getSalGljt()));
desSalary.setSalKhjljcj(oriSalary.getSalKhjljcj()+(desSalary.getSalKhjljcj()==null?0:desSalary.getSalKhjljcj()));
desSalary.setSalJjrjcj(oriSalary.getSalJjrjcj()+(desSalary.getSalJjrjcj()==null?0:desSalary.getSalJjrjcj()));
desSalary.setSalJxzxhj(oriSalary.getSalJxzxhj()+(desSalary.getSalJxzxhj()==null?0:desSalary.getSalJxzxhj()));
desSalary.setSalZqfxsczgj(oriSalary.getSalZqfxsczgj()+(desSalary.getSalZqfxsczgj()==null?0:desSalary.getSalZqfxsczgj()));
desSalary.setSalQtcxwsr(oriSalary.getSalQtcxwsr()+(desSalary.getSalQtcxwsr()==null?0:desSalary.getSalQtcxwsr()));
desSalary.setSalZyf(oriSalary.getSalZyf()+(desSalary.getSalZyf()==null?0:desSalary.getSalZyf()));
desSalary.setSalJjx(oriSalary.getSalJjx()+(desSalary.getSalJjx()==null?0:desSalary.getSalJjx()));
desSalary.setSalYfs(oriSalary.getSalYfs()+(desSalary.getSalYfs()==null?0:desSalary.getSalYfs()));
desSalary.setRzrqYxjl(oriSalary.getRzrqYxjl()+(desSalary.getRzrqYxjl()==null?0:desSalary.getRzrqYxjl()));
desSalary.setSalCpxsjl(oriSalary.getSalCpxsjl()+(desSalary.getSalCpxsjl()==null?0:desSalary.getSalCpxsjl()));
desSalary.setSalCpxssy(oriSalary.getSalCpxssy()+(desSalary.getSalCpxssy()==null?0:desSalary.getSalCpxssy()));
desSalary.setSalCpyjbl(oriSalary.getSalCpyjbl()+(desSalary.getSalCpyjbl()==null?0:desSalary.getSalCpyjbl()));
return desSalary;
}
展开全文
• 以下是《奖惩汇总月报表(DOC格式)》简单预览,如果需要完整表格学习参考,请点击下载。...……………………该文档为奖惩汇总月报表(DOC格式),是一份很不错的参考资料,具有较高参考价值,感兴趣的可以下载看看
• 存货统计表(汇总月报表)PPT以围绕物流采购为核心,以方便大家了解学习存货统计表(汇总月报表)PPT为前...该文档为存货统计表(汇总月报表)PPT,是一份很不错的参考资料,具有较高参考价值,感兴趣的可以下载看看
• SAP 常用报表汇总 •采购管理: 1、采购标准分析 (每每采购组织,每地点采购多少商品,可以按单品) MCE7 2、GR/IR 余额查询 MB5S •库存管理: 3、供应商寄售、客户寄售
SAP 常用报表汇总
•采购管理:
1、采购标准分析 (每月每采购组织,每地点采购多少商品,可以按单品)
MCE7
2、GR/IR 余额查询
MB5S
•库存管理:
3、供应商寄售、客户寄售
MB54 / MB58
4、商品库存查询 MB52
展开全文
• -- 1.19将每个客户按生成汇总报表,用SQL该如何求解? Create table T0119C( 客户编号 varchar(24), 客户抬头 varchar(23) ); Insert INTO T0119C VALUES('0001','A公司'); Insert INTO T0119C VALUES('0002',...
Mysql 刷题笔记
-- 1.19将每个客户按月生成汇总报表,用SQL该如何求解?
Create table T0119C(
客户编号 varchar(24),
客户抬头 varchar(23)
);
Insert INTO T0119C VALUES('0001','A公司');
Insert INTO T0119C VALUES('0002','B公司');
Insert INTO T0119C VALUES('0003','C公司');
Create table T0119X(
客户编号 varchar(24),
日期 Date,
金额 int
);
Insert INTO T0119X VALUES('0001','2018-9-12',2000);
Insert INTO T0119X VALUES('0001','2018-9-16',1500);
Insert INTO T0119X VALUES('0001','2018-10-23',3000);
Insert INTO T0119X VALUES('0002','2018-9-15',3200);
Insert INTO T0119X VALUES('0002','2018-10-19',5000);
Create table T0119Y(
客户编号 varchar(24),
日期 Date,
金额 int
);
Insert INTO T0119Y VALUES('0001','2018-9-12',12000);
Insert INTO T0119Y VALUES('0001','2018-10-16',10000);
Insert INTO T0119Y VALUES('0001','2018-10-23',20000);
Insert INTO T0119Y VALUES('0002','2018-11-15',13200);
Insert INTO T0119Y VALUES('0002','2018-10-19',25000);
T0119C
+--------------+--------------+
| 客户编号 | 客户抬头 |
+--------------+--------------+
| 0001 | A公司 |
| 0002 | B公司 |
| 0003 | C公司 |
+--------------+--------------+
T0119X
+--------------+------------+--------+
| 客户编号 | 日期 | 金额 |
+--------------+------------+--------+
| 0001 | 2018-09-12 | 2000 |
| 0001 | 2018-09-16 | 1500 |
| 0001 | 2018-10-23 | 3000 |
| 0002 | 2018-09-15 | 3200 |
| 0002 | 2018-10-19 | 5000 |
+--------------+------------+--------+
T0119Y
+--------------+------------+--------+
| 客户编号 | 日期 | 金额 |
+--------------+------------+--------+
| 0001 | 2018-09-12 | 12000 |
| 0001 | 2018-10-16 | 10000 |
| 0001 | 2018-10-23 | 20000 |
| 0002 | 2018-11-15 | 13200 |
| 0002 | 2018-10-19 | 25000 |
+--------------+------------+--------+
结果
+---------+--------------+---------------+---------------+
| 日期 | 客户抬头 | X业务金额 | Y业务金额 |
+---------+--------------+---------------+---------------+
| 2018-09 | A公司 | 3500 | 12000 |
| 2018-09 | B公司 | 3200 | NULL |
| 2018-10 | A公司 | 3000 | 30000 |
| 2018-10 | B公司 | 5000 | 25000 |
| 2018-11 | B公司 | NULL | 13200 |
+---------+--------------+---------------+---------------+
SELECT DATE_FORMAT(t.业务日期,'%Y-%m') 日期,c.客户抬头,
SUM(t.x业务金额) AS X业务金额 ,SUM(t.y业务金额) AS Y业务金额
FROM
(
SELECT x.客户编号,x.日期 业务日期,x.金额 x业务金额,y.金额 y业务金额
FROM t0119x x LEFT JOIN t0119y y
ON x.客户编号 = y.客户编号 AND x.日期 = y.日期
UNION
SELECT y.客户编号,y.日期 业务日期,x.金额 x业务金额,y.金额 y业务金额
FROM t0119x x RIGHT JOIN t0119y y
ON x.客户编号 = y.客户编号 AND x.日期 = y.日期
)t
INNER JOIN t0119c c ON t.客户编号 = c.客户编号
GROUP BY 日期,t.客户编号
ORDER BY 日期
展开全文
• 这个软件的报表功能模块,可以按天,,年生成不同类型的报表报表类型包括工作统计,网络流量,程序记录,网站记录,键盘记录,剪贴板,文件记录,USB设备,打印记录,邮件接收,系统事件,报警记录,关键字,...
文章目录iMonitor EAM的报表功能一、电脑工作统计报表详情信息二、 网络流量统计报表三、程序使用统计报表
iMonitor EAM的报表功能
iMonitor EAM(官网:www.imonitorsoft.cn)是静默模式下监控企业员工电脑操作及上网行为的监管系统。这个软件的报表功能模块,可以按天,月,年生成不同类型的报表。报表类型包括工作统计,网络流量,程序记录,网站记录,键盘记录,剪贴板,文件记录等等。
一、电脑工作统计报表
电脑工作统计报表,可以统计每台客户端的运行时间,空闲时间,上网时间,聊天时间,以小时为单位进行统计,使多台客户端形成对比,对员工的工作效率进行分析。
详情信息
通过对每台客户端的监控数据进行统计分析,报表可以按照各个属性进行排序,比如:按照键盘记录的数量(即键盘敲击次数)进行从大到小或者从小到大进行排序,侧面反映出员工的工作程度,还可以电脑运行时间,空闲时间,浏览的网页数等对员工电脑进行排序。
报表可以列出工作时间少于6小时的员工电脑,开机时间晚于8点,键盘敲击次数少于5000次,网页浏览时间大于3小时,聊天时间大于2小时等各个方面对员工的工作状态与效率进行统计。
二、 网络流量统计报表
根据部门的传入传出流量对客户端进行统计分析,了解员工的上网情况。
三、程序使用统计报表
可以统计每一台客户端上的程序使用情况,根据程序使用的时间和程序使用的次数通过柱状图显示,按照从大到小进行排序,分析出员工最常用的办公工具及其使用时长,禁止掉与工作无关但使用频繁的软件,避免影响工作效率。
报表还会统计使用程序的用户,程序名称,程序进程名称,程序使用时长,程序使用次数。
展开全文
• 假设工作簿中按顺序新建3张表叫1和2和3 。如何切换到第2张表? Sheet2.select //sheet2是表的默认名称。重命名只是给sheet2起一个别名 Sheets(2).select //sheets(2)指工作簿的第2张表 Sheets(“2”)....
• SELECT v.pk_org,v.name,SUM(A) "A",SUM(B) "B",SUM(C) "C",SUM(D) "D",SUM(E) "E",SUM(F) "F",SUM(G) "G",SUM(H) "H",SUM(I) "I",SUM(J) "J",SUM(K) "K",SUM(L) "L",SUM(SUM) FROM (SELECT e.pk_org,o.name, ...
• 最近,开发的时候用到了finereport做报表,砸死报表导出Excel的时候,发现导出的数据不能按月汇总。即使在报表设计器了把格式改成日期类型,也不能汇总。 后来查了数据库设计才知道,表的日期字段类型是VARCHAR2,...
• 1104报表模版汇总(2013).xlsx
热门讨论 2013-10-21 22:15:29
S3f汽车金融公司异地业务情况月报表 S3g第I部分:租赁债权资产质量情况表 S3g第II部分:租赁物价值波动及风险缓释情况表 S3g第III部分:金融租赁公司信用风险缓释情况表 S3h金融租赁公司流动性期限缺口情况表 S3j...
• excel财务报表条件匹配,数据汇总项目要求主要运用的excel公式具体实现时的思路按条件汇总思路解决困难项标签汇总,用标签汇总其他数据遇到的操作失误 项目要求 接手一个excel项目,为一家公司完成财务报表里的具体...
• gid qty fdate a01 1 2012-1-1 a02 2 2012-1-1 a03 35 2012-1-1 a01 100 2012-1-3 ...如何得到当月每天的 报表 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 a01 1 100 100 500 800 a02 2 200 a03 35
• 自动轮询汇总报表 所涉系统名称 券商披露网站 人工操作(时间/次) 36小时 所涉人工数量 1 操作频率 每 场景流程 1、每初机器人自动登录网站轮询36家券商披露的财务报告,并下载 2、机器人将下载下来的报告按照...
• 1 import xlrd 2 import xlwt 3 from xlutils.copy ... 5 objWb = xlrd.open_workbook(r'C:\Users\IBM\Desktop\新建文件夹\S1-3\7下旬入库表.xlsx') 6 objSht = objWb.sheet_by_index(0) 7 # 定义列表,...
• 现在要每个合并多个地区上报的 Excel,每个 Excel 都包含多 sheet。将合并汇总结果保存到新 Excel 中,格式保持不变。 各地 Excel 内容如下,需要将多个 sheet 数据都汇总(求和): 实现步骤: 首先准备一个...
• 4、依据已录入的监测数据生成监测日报表、周报表及月报表;5、各阶段工作量统计;6、查询单点历史监测数据和各阶段监测数据;7、监测时程曲线图生成。下载地址:链接:https://pan.baidu.com/s/13JC...
• 公式字段1:(t_iid) 放详细资料节 WhilePrintingRecords; CurrencyVar mySum; mySum:=mySum + {pord_pp2_vw.i_id} //项次或ID 公式字段2::(t_wei)放页尾 WhilePrintingRecords; CurrencyVar mySum;...Whil...
• 汇总函数的条件 以下是每个汇总函数的条件列表: ...每天每周每两周每半月每每季每半年每年 时间条件 每秒每分钟每小时上午/下午 Sum Basic 语法和 Crystal
• 汇总函数的条件<?XML:NAMESPACE PREFIX = O /> 以下是每个汇总函数的条件列表: 布尔型条件 任何更改 更改为“是” 更改为“否” 对每个“是” ...每...
• 信息系统开发平台OpenExpressApp - 框架待完善工作事项信息系统开发平台OpenExpressApp - 报表模块支持ReportObjectView信息系统开发平台OpenExpressApp - 从compositewpf到MEF信息系统开发平台OpenExpressApp -...
• 本文以2012年各产品销售分类汇总报表为例,演示如何在 ActiveReports 报表控件实现文档目录。 1、创建报表文件 在应用程序中创建一个名为 rptMonthlySalesByCategory.cs 的 ActiveReports 报表文件,ActiveRepor
• 报表中“组”是经常使用来显示汇总数据的方式,通过组可以让数据进行结构化的汇总,以方便浏览者解读报表信息。在复杂的商业报表中,经常会具有多重的组结构,例如,时间就可能会有年、季、、日,为了方便使用者...
• 报表开发中经常会遇到需要进行组内排序的报表,如按月份的分组汇总值排序显示,并显示每销售额前十名的记录。使用报表工具一般通过隐藏行列辅助可以实现,下面通过实例说明润乾报表的实现过程,以及改进方案。 ...
...
|
# 大叔学ML第二:线性回归
## 基本形式
$$\begin x_1^{(1)} & x_2^{(1)} & \cdots &x_n^{(1)}\ x_1^{(2)} & x_2^{(2)} & \cdots & x_n^{(2)}\ \vdots & \vdots & \vdots & \vdots\ x_1^{(m)} & x_2^{(m)} & \cdots & x_n^{(m)}\ \end$$
$$\begin y^{(1)} \ y^{(2)} \ \vdots \ y^{(m)} \ \end$$
$$h(x_1,x_2 \dots x_n)= \theta_0 + \theta_1 x_1 + \theta_2 x_2 + \dots + \theta_n x_n \tag{1}$$
$$h(x_1,x_2 \dots x_n)= \theta_0x_0 + \theta_1 x_1 + \theta_2 x_2 + \dots + \theta_n x_n \tag{2}$$
$$j(\theta_0,\theta_1\dots \theta_n)=\frac{1}{2m}\sum_m (h(x_1{(k)},x_2^{(k)} \dots x_n^{(k)}) - y^{(k)})^2$$
$$j(\theta_0,\theta_1\dots \theta_n)=\frac{1}{2m}\sum_{k=1}^m (\theta_0x_0^{(k)} + \theta_1 x_1^{(k)} + \theta_2 x_2^{(k)} + \dots + \theta_n x_n^{(k)} - y^{(k)})^2 \tag{3}$$
## 求解参数$\vec\theta$
### 梯度下降法
• $$\frac{\partial}{\partial\theta_0}j(\theta_0,\theta_1\dots \theta_n) = \frac{1}{m}\sum_{k=1}^m(\theta_0x_0^{(k)} + \theta_1x_1^{(k)} + \dots+ \theta_nx_n^{(k)} - y^{(k)})x_0^{(k)}$$
• $$\frac{\partial}{\partial\theta_1}j(\theta_0,\theta_1\dots \theta_n) = \frac{1}{m}\sum_{k=1}^m(\theta_0x_0^{(k)} + \theta_1x_1^{(k)} + \dots+ \theta_nx_n^{(k)}- y^{(k)})x_1^{(k)}$$
• $$\dots$$
• $$\frac{\partial}{\partial\theta_n}j(\theta_0,\theta_1\dots \theta_n) = \frac{1}{m}\sum_{k=1}^m(\theta_0x_0^{(k)} + \theta_1x_1^{(k)} + \dots+ \theta_nx_n^{(k)}- y^{(k)})x_n^{(k)}$$
import numpy as np
''' 求theta位置的梯度.
Args:
X: 样本
Y: 样本标记
m: 样本数
theta: 欲求梯度的位置
Returns:
gi: theta处函数的梯度值
'''
theta_size = np.size(theta)
g = np.zeros(theta_size)
for i in range(theta_size):
gi = 0 #第i个theta分量对应的偏导
for j in range(m):
gi += ((np.dot(X[j], theta) - Y[j]) * X[j, i])
gi = gi / m
g[i] = gi
return g
def gradient_descent(X, Y, step = 0.02, threshold = 0.01):
''' 梯度下降法求使代价函数最小的 theta
Args:
X: 样本
Y: 样本标记
step:步长
threshold:梯度模长阈值,低于此值时停止迭代
Returns:
theta: 使代价函数取最小值的theta
'''
theta = np.random.rand(4)
while(norm > threshold):
return theta
''' 以下是测试数据 '''
# 测试用线性函数
def linear_function(x1, x2, x3):
result = 1 + 2 * x1 + 3 * x2 + 4 * x3
result = result + np.random.rand() # 噪音
return result
# 计算函数值
def calculate(X):
rowsnumber = np.size(X, axis = 0)
Y = [linear_function (X[i, 0], X[i, 1], X[i, 2]) for i in range(0, rowsnumber)]
return Y
if __name__ == "__main__":
row_count = 500
X = np.random.randint(0, 10, (row_count, 3)) # 随机产生row_count个样本
Y = calculate(X) # 计算标记
X0 = np.ones((row_count, 1))
X = np.hstack((X0, X)) # 补充一列1
print('theta is ', theta)
$$\frac{\partial}{\partial\theta_n}j(\theta_0,\theta_1\dots \theta_n) = (\theta_0x_0^{(k)} + \theta_1x_1^{(k)} + \dots+ \theta_nx_n^{(k)}- y^{(k)})x_n^{(k)} \tag{5}$$
def gradient_sgd(X, Y, m, theta):
''' 求theta位置的梯度.
Args:
X: 样本
Y: 样本标记
m: 样本数
theta: 欲求梯度的位置
Returns:
gi: theta处函数的梯度值
'''
theta_size = np.size(theta)
g = np.zeros(theta_size)
for i in range(theta_size):
random_Index = np.random.randint(1, m + 1)
gi = ((np.dot(X[random_Index], theta) - Y[random_Index]) * X[random_Index, i])
g[i] = gi
return g
theta is [1.43718942 2.00043557 3.00620849 4.00674728]
### 正规方程导法
$$\begin x_0^{(1)} & x_1^{(1)} & x_2^{(1)} & \cdots &x_n^{(1)}\ x_0^{(2)} &x_1^{(2)} & x_2^{(2)} & \cdots & x_n^{(2)}\ \vdots & \vdots & \vdots & \vdots & \vdots\ x_0^{(m)} & x_1^{(m)} & x_2^{(m)} & \cdots & x_n^{(m)}\ \end$$
$$J(\vec\theta)=\frac{1}{2m}||X\vec\theta - \vec{y}||^2 \tag{6}$$
$$\begin J(\vec\theta)&=\frac{1}{2m}||X\vec\theta - \vec||2 \ &=\frac{1}{2m}(X\vec\theta - \vec)T(X\vec\theta - \vec) \ &=\frac{1}{2m}(\vec\theta TX T - \vecT)(X\vec\theta - \vec) \ &=\frac{1}{2m}(\vec\theta TXTX\vec\theta - \vec\thetaTX^T\vec- \vecTX\vec\theta + \vecT\vec)\ &=\frac{1}{2m}(\vec\theta TX TX\vec\theta - 2\vec^TX\vec\theta + \vec^T\vec)\ \end$$
$$\frac{d}{d\vec\theta}J(\vec\theta)=\frac{1}{m}(X^TX\vec\theta-X^T\vec{y})$$
# 测试用线性函数
def linear_function(x1, x2, x3):
result = 1 + 2 * x1 + 3 * x2 + 4 * x3
result = result + np.random.rand() # 噪音
return result
# 计算函数值
def calculate(X):
rowsnumber = np.size(X, axis = 0)
Y = [linear_function (X[i, 0], X[i, 1], X[i, 2]) for i in range(0, rowsnumber)]
return Y
if __name__ == "__main__":
row_count = 500
X = np.random.randint(0, 10, (row_count, 3)) # 随机产生row_count个样本
Y = calculate(X) # 计算标记
X0 = np.ones((row_count, 1))
X = np.hstack((X0, X)) # 补充一列1
theta = np.dot(np.dot(np.linalg.pinv(np.dot(X.T, X)), X.T), np.array(Y).T)
print('theta is ', theta)
### 调用函数库
import numpy as np
from sklearn import linear_model
# 测试用线性函数
def linear_function(x1, x2, x3):
result = 1 + 2 * x1 + 3 * x2 + 4 * x3
result = result + np.random.rand() # 噪音
return result
# 计算函数值
def calculate(X):
rowsnumber = np.size(X, axis = 0)
Y = [linear_function (X[i, 0], X[i, 1], X[i, 2]) for i in range(0, rowsnumber)]
return Y
if __name__ == "__main__":
row_count = 500
X = np.random.randint(0, 10, (row_count, 3)) # 随机产生row_count个样本
Y = calculate(X) # 计算标记
regr = linear_model.LinearRegression()
regr.fit(X, np.array(Y).T)
a, b = regr.coef_, regr.intercept_
print(a)
print(b)
[2.00384674 2.99234723 3.99603084]
1.5344826581936104
posted @ 2018-12-15 19:13 会长 阅读(777) 评论(2编辑 收藏 举报
|
舰炮身管长度的确定方法
舰船科学技术 2022, Vol. 44 Issue (23): 185-189 DOI: 10.3404/j.issn.1672-7649.2022.23.039 PDF
The determination method on the barrel length of naval gun
LI Xiang, PENG Song-jiang, WANG Lin-lin
The 713 Research Institute of CSSC, Zhengzhou 450015, China
Abstract: From the mission of naval gun , studied on the method for determination of barrel length when the original design without prototype reference, can through the mission analysis, exterior ballistic calculation, charging design, interior ballistic calculation can initially determine the length of the gun, through optimization design, and comprehensive balance compatible variety of ammunition capacity, barrel stiffness, the burning ofgunpowder, muzzle pressure and barrel life, reasonably determine the length of the gun.In the modification design, if important tactical and technical indicators such as firing type and maximum range change or major technical improvement in the launch charge, the method to determine the barrellengthis illustrated with a certain naval gun as an example.It has a reference role in the demonstration of naval gun barrel length and barrel design in our country.
Key words: naval gun barrel exterior ballistic interior ballistic charging design
0 引 言
1 舰炮原始设计时身管长度的确定方法
图 1 舰炮原始设计时确定身管长度流程图 Fig. 1 Flow chart for determining barrel length during the original design of the naval gun
1.1 初始条件
1.2 外弹道设计
${\rm{d}}X = \frac{{\partial X}}{{\partial C}}{\rm{d}}C + \frac{{\partial X}}{{\partial {v_g}}}{\rm{d}}{v_g} + \frac{{\partial X}}{{\partial {\theta _0}}}{\rm{d}}{\theta _0}。$ (1)
1.3 内弹道设计
1)装药弹道设计
$v_g=v(y_1\text{,}y_2\text{,}y_3\text{,}y_4\text{,}\cdots\cdots)。$ (2)
$E_1=mv^2/2,$ (3)
$E\approx 3E_1。$ (4)
$\gamma_g=(k-1)\frac{\dfrac{1}{2}mv^2_g}{f\omega}。$ (5)
2)内弹道设计
$l_g=f\left(p_m,v_g,\Delta,\frac{\omega}{m}\right) ,$ (6)
$v_g=\sqrt{\frac{2S}{\varphi m}\int^{l_g}_0 p{\rm{d}}l}。$ (7)
$\displaystyle \int^{l_g}_0p{\rm{d}}l$ 就是p-l曲线(内弹道正面问题可以解出,见图2)下面的面积,也就是火药气体做功的大小。由式(7)可以看出,在给定初速vg的情况下,不同的内膛构造参数,就可以给出各种不同的 $\displaystyle \int^{l_g}_0p{\rm{d}}l$ ;即使相同的 $\displaystyle\int^{l_g}_0p{\rm{d}}l$ 也因为p-l曲线的不同,得出多种不同的弹丸全行程长lg[3],也就是说弹丸全行程长lg是多解的。因此弹丸全行程长lg的确定是一个反复权衡的过程。
图 2 p-l曲线 Fig. 2 Curve of p-l
$l_b=l_g+l_{V_0}。$ (8)
1.4 确定身管长度时需考虑的其他问题
1)兼容多种弹药能力
2)身管刚度
3)火药膛内燃尽性
4)炮口压力
5)身管寿命
2 舰炮改进设计时身管长度的确定方法
图 3 54 d身管的变形云图(最大变形量9.498 mm) Fig. 3 54 d barrel length,without support, picture of deformation (max deformation 9.498 mm)
图 4 62d身管的变形云图(最大变形量18.885 mm) Fig. 4 62d barrel length,without support, picture of deformation (max deformation 18.885 mm)
图 5 54d身管长度、带支撑时身管的变形云图(最大变形量5.116 mm) Fig. 5 54d barrel length,with support, picture ofdeformation (max deformation 5.116 mm)
图 6 62d身管长度、带与54d身管长度相同支撑时身管的变形云图(最大变形量11.014 mm) Fig. 6 62d barrel length,with support same as 54 d, picture ofdeformation (max deformation 11.014 mm)
图 7 62d 身管长度、带加长 200 mm支撑时的变形云图(最大变形量 10.546 mm) Fig. 7 62d barrel length,with support extend to 200 mm, picture of deformation (max deformation 10.546 mm)
图 8 62d 身管长度、带加长 500 mm支撑时身管身管的变形云图(最大变形量 9.702 mm) Fig. 8 62d barrel length,with support extend to 500 mm, picture of deformation (max deformation 9.702 mm)
3 结 语
[1] Jane's Weapons Naval[M]. 2018-2019. [2] 韩子鹏, 等. 弹箭外弹道学[M]. 北京: 北京理工大学出版社, 2014. [3] 张小兵. 枪炮内弹道学[M]. 北京: 北京理工大学出版社, 2014. [4] 王泽山, 何卫东, 徐复铭. 火炮发射装药设计原理与技术[M]. 北京: 北京理工大学出版社, 2014. [5] 张相炎, 郑建国, 袁人枢. 火炮设计理论[M]. 北京: 北京理工大学出版社, 2014. [6] 唐浩宇. PP87式82 mm迫击炮远程杀伤榴弹发射装药研究[D]. 南京: 南京理工大学, 2005. [7] 鲍密. 按序开裂杆状药在某制导炮弹内弹道中的应用研究[D]. 南京: 南京理工大学, 2013.
|
• Index
关于作者
函数
\mathrm{πr}^2
var r1 = 12.34;
var r2 = 9.08;
var r3 = 73.1;
var s1 = 3.14 * r1 * r1;
var s2 = 3.14 * r2 * r2;
var s3 = 3.14 * r3 * r3;
抽象
\sum_{n=1}^{100}n
\sum_{n=1}^{100}n^2+1
(1\times1+1)+(2\times2+1)+(3\times3+1)+\dots+(100\times100+1)
|
# Codeforces Round #616 (Div. 2)
## A. Even But Not Even
time limit per test1 second memory limit per test256 megabytes
Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what ebne numbers are, you can look at the sample notes for more clarification.
You are given a non-negative integer s, consisting of n digits. You can delete some digits (they are not necessary consecutive/successive) to make the given number ebne. You cannot change the order of the digits, that is, after deleting the digits the remaining digits collapse. The resulting number shouldn't contain leading zeros. You can delete any number of digits between 0 (do not delete any digits at all) and n-1.
For example, if you are given s=222373204424185217171912 then one of possible ways to make it ebne is: 222373204424185217171912 \rightarrow 2237344218521717191. The sum of digits of 2237344218521717191 is equal to 70 and is divisible by 2, but number itself is not divisible by 2: it means that the resulting number is ebne.
Find any resulting number that is ebne. If it's impossible to create an ebne number from the given number report about it.Input
The input consists of multiple test cases. The first line contains a single integer $$t (1 \le t \le 1000)$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer $$n (1 \le n \le 3000)$$ — the number of digits in the original number.
The second line of each test case contains a non-negative integer number s, consisting of n digits.
It is guaranteed that s does not contain leading zeros and the sum of n over all test cases does not exceed 3000.Output
For each test case given in the input print the answer in the following format:
• If it is impossible to create an ebne number, print "-1" (without quotes);
• Otherwise, print the resulting number after deleting some, possibly zero, but not all digits. This number should be ebne. If there are multiple answers, you can print any of them. Note that answers with leading zeros or empty strings are not accepted. It's not necessary to minimize or maximize the number of deleted digits.
ExampleinputCopy
4
4
1227
1
0
6
177013
24
222373204424185217171912
outputCopy
1227
-1
17703
2237344218521717191
Note
In the first test case of the example, 1227 is already an ebne number (as 1 + 2 + 2 + 7 = 12, 12 is divisible by 2, while in the same time, 1227 is not divisible by 2) so we don't need to delete any digits. Answers such as 127 and 17 will also be accepted.
In the second test case of the example, it is clearly impossible to create an ebne number from the given number.
In the third test case of the example, there are many ebne numbers we can obtain by deleting, for example, 1 digit such as 17703, 77013 or 17013. Answers such as 1701 or 770 will not be accepted as they are not ebne numbers. Answer 013 will not be accepted as it contains leading zeroes.
Explanation:
• 1 + 7 + 7 + 0 + 3 = 18. As 18 is divisible by 2 while 17703 is not divisible by 2, we can see that 17703 is an ebne number. Same with 77013 and 17013;
• 1 + 7 + 0 + 1 = 9. Because 9 is not divisible by 2, 1701 is not an ebne number;
• 7 + 7 + 0 = 14. This time, 14 is divisible by 2 but 770 is also divisible by 2, therefore, 770 is not an ebne number.
In the last test case of the example, one of many other possible answers is given. Another possible answer is: $$222373204424185217171912 \rightarrow 22237320442418521717191$$ (delete the last digit).
#### 签到,选两个奇数
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
typedef long long ll;
const int maxn=(int)2e5+100;
const int mod=(int)1e9+7;
int n;
char s[maxn];
void solve(){
scanf("%d%s",&n,s+1);
int cnt=0,ans=0;
rep(i,1,n){
if((s[i]-'0')%2) cnt++,ans=ans*10+s[i]-'0';
if(cnt==2) return (void)printf("%d\n",ans);
}
puts("-1");
}
int main(){
int T;cin>>T;
while(T--) solve();
}
## B. Array Sharpening
time limit per test1 second memory limit per test256 megabytes
You're given an array $$a_1, \ldots, a_n$$of n non-negative integers.
Let's call it sharpened if and only if there exists an integer $$1 \le k \le n$$ such that$$a_1 < a_2 < \ldots < a_k and a_k > a_{k+1} > \ldots > a_n$$. In particular, any strictly increasing or strictly decreasing array is sharpened. For example:
• The arrays [4], [0, 1], [12, 10, 8] and [3, 11, 15, 9, 7, 4] are sharpened;
• The arrays [2, 8, 2, 8, 6, 5], [0, 1, 1, 0] and [2, 5, 6, 9, 8, 8] are not sharpened.
You can do the following operation as many times as you want: choose any strictly positive element of the array, and decrease it by one. Formally, you can choose any $$i (1 \le i \le n)$$ such that $$a_i>0$$and assign $$a_i := a_i - 1$$.
Tell if it's possible to make the given array sharpened using some number (possibly zero) of these operations.Input
The input consists of multiple test cases. The first line contains a single integer$$t (1 \le t \le 15\ 000)$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer $$n (1 \le n \le 3 \cdot 10^5)$$.
The second line of each test case contains a sequence of n non-negative integers $$a_1, \ldots, a_n (0 \le a_i \le 10^9)$$.
It is guaranteed that the sum of n over all test cases does not exceed $$3 \cdot 10^5$$.Output
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.ExampleinputCopy
10
1
248618
3
12 10 8
6
100 11 15 9 7 8
4
0 1 1 0
2
0 0
2
0 1
2
1 0
2
1 1
3
0 1 0
3
1 0 1
outputCopy
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Note
In the first and the second test case of the first test, the given array is already sharpened.
In the third test case of the first test, we can transform the array into [3, 11, 15, 9, 7, 4] (decrease the first element 97 times and decrease the last element 4 times). It is sharpened because 3 < 11 < 15 and 15 > 9 > 7 > 4.
In the fourth test case of the first test, it's impossible to make the given array sharpened.
#### 其实问题就是能否找到一个中心点使得他向两端延伸都合法,那么就正着跑一次反着跑一次就可以了
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
typedef long long ll;
const int maxn=(int)4e5+100;
const int mod=(int)1e9+7;
int n,a[maxn],l[maxn],r[maxn];
void solve(){
scanf("%d",&n);
rep(i,1,n) scanf("%d",&a[i]),l[i]=r[i]=0;
rep(i,1,n){
if(a[i]>=i-1) l[i]=1;
else break;
}
dep(i,n,1){
if(a[i]>=n-i) r[i]=1;
else break;
}
rep(i,1,n) if(l[i]*r[i]) return (void)puts("Yes");
puts("No");
}
int main(){
int T;cin>>T;
while(T--) solve();
}
## C. Mind Control
time limit per test1 second memory limit per test256 megabytes
You and your n - 1 friends have found an array of integers $$a_1, a_2, \dots, a_n$$. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses either the first or the last element of the array, removes it, and keeps it for himself. He then gets out of line, and the next person in line continues the process.
You are standing in the m-th position in the line. Before the process starts, you may choose up to k different people in the line, and persuade them to always take either the first or the last element in the array on their turn (for each person his own choice, not necessarily equal for all people), no matter what the elements themselves are. Once the process starts, you cannot persuade any more people, and you cannot change the choices for the people you already persuaded.
Suppose that you're doing your choices optimally. What is the greatest integer x such that, no matter what are the choices of the friends you didn't choose to control, the element you will take from the array will be greater than or equal to x?
Please note that the friends you don't control may do their choice arbitrarily, and they will not necessarily take the biggest element available.Input
The input consists of multiple test cases. The first line contains a single integer$$t (1 \le t \le 1000)$$— the number of test cases. The description of the test cases follows.
The first line of each test case contains three space-separated integers n, m and $$k (1 \le m \le n \le 3500, 0 \le k \le n - 1)$$ — the number of elements in the array, your position in line and the number of people whose choices you can fix.
The second line of each test case contains n positive integers $$a_1, a_2, \dots, a_n (1 \le a_i \le 10^9)$$ — elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 3500.Output
For each test case, print the largest integer x such that you can guarantee to obtain at least x.ExampleinputCopy
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2
outputCopy
8
4
1
1
Note
In the first test case, an optimal strategy is to force the first person to take the last element and the second person to take the first element.
• the first person will take the last element (5) because he or she was forced by you to take the last element. After this turn the remaining array will be [2, 9, 2, 3, 8];
• the second person will take the first element (2) because he or she was forced by you to take the first element. After this turn the remaining array will be [9, 2, 3, 8];
• if the third person will choose to take the first element (9), at your turn the remaining array will be [2, 3, 8] and you will take 8 (the last element);
• if the third person will choose to take the last element (8), at your turn the remaining array will be [9, 2, 3] and you will take 9 (the first element).
Thus, this strategy guarantees to end up with at least 8. We can prove that there is no strategy that guarantees to end up with at least 9. Hence, the answer is 8.
In the second test case, an optimal strategy is to force the first person to take the first element. Then, in the worst case, both the second and the third person will take the first element: you will end up with 4.
#### 看到n,m的范围就知道可以暴力乱搞;令$$k=min(k,m-1)$$表示的是我前面还有k个人可以控制,那么也就是还有m-1-k个人不能控制,那我们就枚举我可以控制的k个人中取第一个元素的人的个数,确定了这个之后我们再去枚举剩下不能控制的人选第一个还是最后一个的所有可能,更新最大值即可
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
typedef long long ll;
const int maxn=(int)4e5+100;
const int mod=(int)1e9+7;
int n,m,k,a[maxn];
void solve(){
scanf("%d%d%d",&n,&m,&k);
rep(i,1,n) scanf("%d",&a[i]);
k=min(k,m-1);
int ans=0;
rep(i,0,k){
int tmp=mod;
rep(j,0,m-1-k){
tmp=min(tmp,max(a[i+j+1],a[n-m+1+i+j]));
}
ans=max(ans,tmp);
}
printf("%d\n",ans);
}
int main(){
int T;cin>>T;
while(T--) solve();
}
## D. Irreducible Anagrams
time limit per test2 seconds memory limit per test256 megabytes
Let's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.
Let's consider two strings s and t which are anagrams of each other. We say that t is a reducible anagram of s if there exists an integer k \ge 2 and 2k non-empty strings $$s_1, t_1, s_2, t_2, \dots, s_k, t_k$$ that satisfy the following conditions:
1. If we write the strings $$s_1, s_2, \dots, s_k$$ in order, the resulting string will be equal to s;
2. If we write the strings$$t_1, t_2, \dots, t_k$$ in order, the resulting string will be equal to t;
3. For all integers i between 1 and k inclusive, $$s_i$$ and $$t_i$$ are anagrams of each other.
If such strings don't exist, then t is said to be an irreducible anagram of s. Note that these notions are only defined when s and t are anagrams of each other.
For example, consider the string s = "gamegame". Then the string t = "megamage" is a reducible anagram of s, we may choose for example $$s_1$$ = "game", $$s_2$$ = "gam",$$s_3$$ = "e" and $$t_1$$ = "mega",$$t_2$$ = "mag",$$t_3$$ = "e":
On the other hand, we can prove that t = "memegaga" is an irreducible anagram of s.
You will be given a string s and q queries, represented by two integers $$1 \le l \le r \le |s|$$ (where |s| is equal to the length of the string s). For each query, you should find if the substring of s formed by characters from the l-th to the r-th has at least one irreducible anagram.Input
The first line contains a string s, consisting of lowercase English characters ($$1 \le |s| \le 2 \cdot 10^5$$).
The second line contains a single integer $$q (1 \le q \le 10^5)$$ — the number of queries.
Each of the following q lines contain two integers l and $$r (1 \le l \le r \le |s|)$$, representing a query for the substring of s formed by characters from the l-th to the r-th.Output
For each query, print a single line containing "Yes" (without quotes) if the corresponding substring has at least one irreducible anagram, and a single line containing "No" (without quotes) otherwise.ExamplesinputCopy
aaaaa
3
1 1
2 4
5 5
outputCopy
Yes
No
Yes
inputCopy
aabbbbbbc
6
1 2
2 4
2 2
1 9
5 7
3 5
outputCopy
No
Yes
Yes
Yes
No
No
Note
In the first sample, in the first and third queries, the substring is "a", which has itself as an irreducible anagram since two or more non-empty strings cannot be put together to obtain "a". On the other hand, in the second query, the substring is "aaa", which has no irreducible anagrams: its only anagram is itself, and we may choose $$s_1$$ = "a",$$s_2$$ = "aa",$$t_1$$ = "a",$$t_2$$ = "aa" to show that it is a reducible anagram.
In the second query of the second sample, the substring is "abb", which has, for example, "bba" as an irreducible anagram.
#### 先说结论,l=r 或 首尾不相等 或 字母种数大于2 就是Yes,否则为No;对于第一种情况l=r,显然是Yes;第二种首尾不相等的情况,假设头是a,尾是b,那么我们先放全部的b,然后随便放字母,就可以构造出来;第三种情况稍复杂,假设三种字母中最后出现的是c,首尾是a,那么我们先放所有的c,再放所有的a,那么可以构造出来一个;其他情况就都是No了
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
typedef long long ll;
const int maxn=(int)2e5+100;
const int mod=(int)1e9+7;
char s[maxn];
int pre[maxn][30];
int main(){
scanf("%s",s+1);
int n=strlen(s+1);
rep(i,1,n) rep(j,0,25) pre[i][j]=pre[i-1][j]+(s[i]-'a'==j);
int q;scanf("%d",&q);
while(q--){
int l,r;scanf("%d%d",&l,&r);
int num=0;
rep(i,0,25) if(pre[r][i]-pre[l-1][i]) num++;
if(l==r||s[l]!=s[r]||num>=3) puts("Yes");
else puts("No");
}
}
## E. Prefix Enlightenment
time limit per test3 seconds memory limit per test256 megabytes
There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets $$A_1, \ldots, A_k of \{1, 2, \dots, n\}$$, such that the intersection of any three subsets is empty. In other words, for all $$1 \le i_1 < i_2 < i_3 \le k, A_{i_1} \cap A_{i_2} \cap A_{i_3}$$ = \varnothing.
In one operation, you can choose one of these k subsets and switch the state of all lamps in it. It is guaranteed that, with the given subsets, it's possible to make all lamps be simultaneously on using this type of operation.
Let $$m_i$$ be the minimum number of operations you have to do in order to make the i first lamps be simultaneously on. Note that there is no condition upon the state of other lamps (between i+1 and n), they can be either off or on.
You have to compute $$m_i$$ for all $$1 \le i \le n$$.Input
The first line contains two integers n and k $$(1 \le n, k \le 3 \cdot 10^5)$$.
The second line contains a binary string of length n, representing the initial state of each lamp (the lamp i is off if s_i = 0, on if s_i = 1).
The description of each one of the k subsets follows, in the following format:
The first line of the description contains a single integer $$c (1 \le c \le n)$$ — the number of elements in the subset.
The second line of the description contains c distinct integers $$x_1, \ldots, x_c (1 \le x_i \le n)$$ — the elements of the subset.
It is guaranteed that:
• The intersection of any three subsets is empty;
• It's possible to make all lamps be simultaneously on using some operations.
Output
You must output n lines. The i-th line should contain a single integer m_i — the minimum number of operations required to make the lamps 1 to i be simultaneously on.ExamplesinputCopy
7 3
0011100
3
1 4 6
3
3 4 7
2
2 3
outputCopy
1
2
3
3
3
3
3
inputCopy
8 6
00110011
3
1 3 8
5
1 2 5 6 7
2
6 8
2
3 5
2
4 7
1
2
outputCopy
1
1
1
1
1
1
4
4
inputCopy
5 3
00011
3
1 2 3
1
4
3
3 4 5
outputCopy
1
1
1
1
1
inputCopy
19 5
1001001001100000110
2
2 3
2
5 6
2
8 9
5
12 13 14 15 16
1
19
outputCopy
0
1
1
1
2
2
2
3
3
3
3
4
4
4
4
4
4
4
5
Note
In the first example:
• For i = 1, we can just apply one operation on $$A_1$$, the final states will be 1010110;
• For i = 2, we can apply operations on $$A_1$$ and $$A_3$$, the final states will be 1100110;
• For $$i \ge 3$$, we can apply operations on $$A_1, A_2$$ and $$A_3$$, the final states will be 1111111.
In the second example:
• For$$i \le 6$$, we can just apply one operation on $$A_2$$, the final states will be 11111101;
• For $$i \ge 7$$, we can apply operations on $$A_1, A_3, A_4, A_6$$, the final states will be 11111111.
#### 第一个条件是任意三个集合的并是空集,那么很容易转换到每个点至多关联两个集合;我们令$$x_i$$表示第i个集合是否选取(0不选1选)对于没有集合关联的点(显然初始状态为1),我们不用管那么对于只关联一个集合的点,$$x_i = 1 \oplus s_a$$对于关联两个集合的点,$$x_i = s_a \oplus s_b$$想到并查集拆点,这个模型很经典;把每个$$x_i$$拆成$$x_{i,0}$$和$$x_{i,1}$$,表示i这个集合选或者不选,那么显然对于所有的$$x_{i,1}$$点的花费是1,$$x_{i,0}$$花费为0;至于怎么连边,我们先考虑关联两个集合的情况;假设关联的集合为a和b,如果$$s_i = 1$$,那也就是说$$x_a$$和$$x_b$$必须相等,那我们就连一条$$x_{a,0}$$到$$x_{b,0}$$的边,和一条$$x_{a,1}$$到$$x_{b,1}$$的边;$$s_i = 0$$同理;那么如何处理只关联一个集合的点呢,很显然这时候$$x_i$$选什么是确定的,我们设一个超级点0,并把这个点的权值设为INF,意思就是和这个点相连的点都是不能选的;那么假设i这个集合必须选,我们只需要把$$x_{i,0}$$连到0号点即可;现在,我们所有的边都连完了,统计答案就只需要得到并查集内联通块权值和的最小值即可;
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
typedef long long ll;
const int maxn=(int)1e6+100;
const int mod=(int)1e9+7;
int n,k,fa[maxn],tot[maxn],ans;
char s[maxn];
vector<int> v[maxn];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
void join(int x,int y){
x=find(x);y=find(y);
if(x!=y) fa[x]=y,tot[y]+=tot[x];
}
int get(int x){return min(tot[find(x)],tot[find(x+k)]);}
int main(){
scanf("%d%d%s",&n,&k,s+1);
rep(i,1,k){
int x,c;scanf("%d",&c);
while(c--) scanf("%d",&x),v[x].pb(i);
}
rep(i,1,2*k+1) fa[i]=i,tot[i]=(i<=k);//[1,k]选,[k+1,2k]不选
tot[2*k+1]=mod;
rep(i,1,n){
if(v[i].size()==1){
int tmp=v[i][0]+(s[i]=='0')*k;
ans-=get(v[i][0]);join(tmp,2*k+1);ans+=get(v[i][0]);
}
if(v[i].size()==2){
int x=v[i][0],y=v[i][1];
if(s[i]=='1'&&find(x)!=find(y)){
ans-=(get(x)+get(y));join(x,y);join(x+k,y+k);ans+=get(x);
}
if(s[i]=='0'&&find(x)!=find(y+k)){
ans-=(get(x)+get(y));join(x,y+k);join(x+k,y);ans+=get(x);
}
}
printf("%d\n",ans);
}
}
0 评论
|
# # Leetcode 第195场周赛题解
## # Problem A - 判断路径是否相交 (opens new window)
class Solution:
def isPathCrossing(self, path: str) -> bool:
s = set()
x = 0
y = 0
dx = {"N": 0, "S": 0, "E": 1, "W": -1};
dy = {"N": 1, "S": -1, "E": 0, "W": 0};
for c in path:
x += dx[c]
y += dy[c]
if (x, y) in s:
return True;
return False
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## # Problem B - 检查数组对是否可以被 k 整除 (opens new window)
class Solution {
public:
bool canArrange(vector<int>& arr, int k) {
vector<int> cnt(k);
for (int i : arr)
cnt[(i % k + k) % k]++;
if (k & 1) {
for (int i = 1; i <= k / 2; ++i)
if (cnt[i] != cnt[k - i])
return false;
if (cnt[0] & 1)
return false;
return true;
} else {
for (int i = 1; i < k / 2; ++i)
if (cnt[i] != cnt[k - i])
return false;
if ((cnt[0] & 1) || (cnt[k / 2] & 1))
return false;
return true;
}
}
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## # Problem C - 满足条件的子序列数目 (opens new window)
const int MOD = 1e9 + 7;
class Solution {
public:
int numSubseq(vector<int>& nums, int target) {
int n = nums.size();
sort(nums.begin(), nums.end());
vector<int> two(n);
two[0] = 1;
for (int i = 1; i < n; ++i)
two[i] = (two[i - 1] << 1) % MOD;
int ans = 0, l = 0;
for (int r = n - 1; r >= 0; --r) {
if (l > r)
l = r;
if (nums[l] + nums[r] > target)
continue;
while (l < r && nums[l + 1] + nums[r] <= target)
l++;
if (l == r)
ans = (ans + two[r]) % MOD;
else
ans = (ans + two[r] - two[r - l - 1]) % MOD;
}
if (ans < 0)
ans += MOD;
return ans;
}
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## # Problem D - 满足不等式的最大值 (opens new window)
class Solution {
public:
int findMaxValueOfEquation(vector<vector<int>>& points, int k) {
int n = points.size();
deque<pair<int, int>> plus, minus;
plus.push_back({points[0][1] + points[0][0], 0});
minus.push_back({points[0][1] - points[0][0], 0});
int ans = INT_MIN;
for (int i = 1; i < n; ++i) {
while (!plus.empty() && points[plus.front().second][0] < points[i][0] - k)
plus.pop_front();
while (!minus.empty() && points[minus.front().second][0] < points[i][0] - k)
minus.pop_front();
int cplus = points[i][1] + points[i][0], cminus = points[i][1] - points[i][0];
if (!plus.empty())
ans = max(ans, cminus + plus.front().first);
if (!minus.empty())
ans = max(ans, cplus + minus.front().first);
while (!plus.empty() && plus.back().first <= cplus)
plus.pop_back();
plus.push_back({cplus, i});
while (!minus.empty() && minus.back().first <= cminus)
minus.pop_back();
minus.push_back({cminus, i});
}
return ans;
}
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
2013
12-04
The Snail
A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail has a fatigue factor of 10%, which means that on each successive day the snail climbs 10% * 3 = 0.3 feet less than it did the previous day. (The distance lost to fatigue is always 10% of the first day’s climbing distance.) On what day does the snail leave the well, i.e., what is the first day during which the snail’s height exceeds 6 feet? (A day consists of a period of sunlight followed by a period of darkness.) As you can see from the following table, the snail leaves the well during the third day.
Day Initial Height Distance Climbed Height After Climbing Height After Sliding
1 0 3 3 2
2 2 2.7 4.7 3.7
3 3.7 2.4 6.1 –
Your job is to solve this problem in general. Depending on the parameters of the problem, the snail will eventually either leave the well or slide back to the bottom of the well. (In other words, the snail’s height will exceed the height of the well or become negative.) You must find out which happens first and on what day.
The input file contains one or more test cases, each on a line by itself. Each line contains four integers H, U, D, and F, separated by a single space. If H = 0 it signals the end of the input; otherwise, all four numbers will be between 1 and 100, inclusive. H is the height of the well in feet, U is the distance in feet that the snail can climb during the day, D is the distance in feet that the snail slides down during the night, and F is the fatigue factor expressed as a percentage. The snail never climbs a negative distance. If the fatigue factor drops the snail’s climbing distance below zero, the snail does not climb at all that day. Regardless of how far the snail climbed, it always slides D feet at night.
For each test case, output a line indicating whether the snail succeeded (left the well) or failed (slid back to the bottom) and on what day. Format the output exactly as shown in the example.
6 3 1 10
10 2 1 50
50 5 3 14
50 6 4 1
50 6 3 1
1 1 1 1
0 0 0 0
success on day 3
failure on day 4
failure on day 7
failure on day 68
success on day 20
failure on day 2
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
double h,u,d,f;
while(~scanf("%lf",&h)&&h){
scanf("%lf%lf%lf",&u,&d,&f);
int day=0;
bool flag=true;
double dist=0,s=u*f/100;
while(1){
day++;
dist+=u;
if(dist>h)break;
dist-=d;
if(dist<0){flag=false;break;};
u-=s;
if(u<0)u=0;
}
if(flag){
printf("success on day %d\n",day);
}else
printf("failure on day %d\n",day);
}
return 0;
}
1. 68的有的是在高架桥上扫街,70也有的是在饭店后厨帮工摘菜,80还有在路口修车的,都是对职业的态度,他们同样辛苦,而且是每天辛苦,而且他们干几年都比不上六小龄童在电视前说几句话,十八九从农村出来打工的除了挨累还要挨骂,20几岁刚毕业的女学生可能还要被领导
|
[提交][状态][讨论版]
## 题目描述
The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166's castle. The castle is a large labyrinth. To make the problem simply, we assume the labyrinth is a N*M two-dimensional array which left-top corner is (0,0) and right-bottom corner is (N-1,M-1). Ignatius enters at (0,0), and the door to feng5166's room is at (N-1,M-1), that is our target. There are some monsters in the castle, if Ignatius meet them, he has to kill them. Here is some rules:
1.Ignatius can only move in four directions(up, down, left, right), one step per second. A step is defined as follow: if current position is (x,y), after a step, Ignatius can only stand on (x-1,y), (x+1,y), (x,y-1) or (x,y+1).
2.The array is marked with some characters and numbers. We define them like this:
. : The place where Ignatius can walk on.
X : The place is a trap, Ignatius should not walk on it.
n : Here is a monster with n HP(1<=n<=9), if Ignatius walk on it, it takes him n seconds to kill the monster.
Your task is to give out the path which costs minimum seconds for Ignatius to reach target position. You may assume that the start position and the target position will never be a trap, and there will never be a monster at the start position.
## 输入
The input contains several test cases. Each test case starts with a line contains two numbers N and M(2<=N<=200,2<=M<=200) which indicate the size of the labyrinth. Then a N*M two-dimensional array follows, which describe the whole labyrinth. The input is terminated by the end of file. More details in the Sample Input.
## 输出
For each test case, you should output is the minimum seconds,More details in the Sample Output.
## 样例输入
5 6
.XX.1.
..X.2.
2...X.
...XX.
XXXXX.
5 6
.XX.1.
..X.2.
2...X.
...XX.
XXXXX1
## 样例输出
13
14
[提交][状态][讨论版]
|
2013
11-10
# Lagrange’s Four-Square Theorem
The fact that any positive integer has a representation as the sum of at most four positive squares (i.e. squares of positive integers) is known as Lagrange’s Four-Square Theorem. The first published proof of the theorem was given by Joseph-Louis Lagrange in 1770. Your mission however is not to explain the original proof nor to discover a new proof but to show that the theorem holds for some specific numbers by counting how many such possible representations there are.
For a given positive integer n, you should report the number of all representations of n as the sum of at most four positive squares. The order of addition does not matter, e.g. you should consider 4^2 + 3^2 and 3^2 + 4^2 are the same representation.
For example, let’s check the case of 25. This integer has just three representations 1^2+2^2+2^2+4^2, 3^2 + 4^2, and 5^2. Thus you should report 3 in this case. Be careful not to count 4^2 + 3^2 and 3^2 + 4^2 separately.
The input is composed of at most 255 lines, each containing a single positive integer less than 2^15, followed by a line containing a single zero. The last line is not a part of the input data.
The output should be composed of lines, each containing a single integer. No other characters should appear in the output.
The output integer corresponding to the input integer n is the number of all representations of n as the sum of at most four positive squares.
1
25
2003
211
20007
0
1
3
48
7
738
/* @author: */
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n, s, t1, t2, t;
while( sc.hasNext() )
{
n=sc.nextInt();
if( n == 0 ) break;
s = 0;
for(int i=(int)Math.sqrt( n/4 ); i*i<=n; i++ )
{
t1=n-i*i;
for(int j=(int)Math.sqrt( t1/3 ); j<=i && j*j<=t1; j++ )
{
t2=t1-j*j;
for(int k=(int)Math.sqrt(t2/2) ; k<=j && k*k<=t2; k++ )
{
t = (int)Math.sqrt( t2 - k*k );
if( t <= k && t*t == t2 - k*k )
s++;
}
}
}
System.out.printf( "%d\n", s );
}
}
}
1. 思路二可以用一个长度为k的队列来实现,入队后判断下队尾元素的next指针是否为空,若为空,则出队指针即为所求。
2. 换句话说,A[k/2-1]不可能大于两数组合并之后的第k小值,所以我们可以将其抛弃。
应该是,不可能小于合并后的第K小值吧
|
## 留言板
引用本文: 陈乾君,蒋媛,刘子建,谭远顺. 具有Gilpin-Ayala增长的随机捕食-食饵模型的动力学行为 [J]. 应用数学和力学,2022,43(4):453-468
CHEN Qianjun, JIANG Yuan, LIU Zijian, TAN Yuanshun. Dynamic Behavior of a Stochastic Predator Prey Model With the Gilpin-Ayala Growth[J]. Applied Mathematics and Mechanics, 2022, 43(4): 453-468. doi: 10.21656/1000-0887.420203
Citation: CHEN Qianjun, JIANG Yuan, LIU Zijian, TAN Yuanshun. Dynamic Behavior of a Stochastic Predator Prey Model With the Gilpin-Ayala Growth[J]. Applied Mathematics and Mechanics, 2022, 43(4): 453-468.
• 中图分类号: O29
## Dynamic Behavior of a Stochastic Predator Prey Model With the Gilpin-Ayala Growth
• 摘要:
该文研究了一类具有Gilpin-Ayala增长的随机捕食-食饵模型的动力学行为,证明了系统全局正解的存在性和唯一性,得到了灭绝性和持久性的充分条件。在此基础上,给出了控制捕食-食饵系统随机持久和灭绝的阈值,并且讨论了系统解的一些渐近性态。最后通过数值模拟,验证了结果的有效性。
• 图 1 不考虑切换,例1参数下,两个子系统解的轨迹:(a) 子系统1,ξ(t)=1;(b) 子系统2,ξ(t)=2
Figure 1. The trajectories of the solutions to the 2 subsystems of example 1 without switching: (a) subsystem 1, ξ(t)=1; (b) subsystem 2, ξ(t)=2
图 2 考虑切换,例1参数下,系统Markov链平稳分布时解的轨迹:(a) π=(0.7,0.3);(b) π=(1/3,2/3)
Figure 2. The trajectories of solutions in stationary distribution of system the Markov chain for example 1 with switching: (a) π=(0.7, 0.3); (b) π=(1/3, 2/3)
图 3 不考虑切换,例2参数下,两个子系统解的轨迹:(a) 子系统1,ξ(t)=1,(σ(1),σ(2))=$(\sqrt{0.12},\sqrt{0.82})$;(b) 子系统2,ξ(t)=2,(σ(1),σ(2))=$(\sqrt{0.82},\sqrt{0.12})$
Figure 3. The trajectories of solutions to the 2 subsystems of example 2 without switching: (a) subsystem 1, ξ(t)=1, (σ(1), σ(2))=$(\sqrt{0.12},\sqrt{0.82})$; (b) subsystem 2, ξ(t)=2, (σ(1), σ(2))=$(\sqrt{0.82},\sqrt{0.12})$
• [1] BERRYMAN A A. The orgins and evolution of predator-prey theory[J]. Ecology, 1992, 73(5): 1530-1535. doi: 10.2307/1940005 [2] APPLETON D. Modelling biological populations in space and time[J]. Journal of the Royal Statistical Society (Series C): Applied Statistics, 1993, 42(2): 411-412. [3] 焦建军, 陈兰荪, 尼托 J J, 等. 连续收获捕食者与脉冲存放食饵的阶段结构捕食-食饵模型的全局吸引和一致持久[J]. 应用数学和力学, 2008, 29(5): 589-600. (JIAO Jianjun, CHEN Lansun, NIETO J J, et al. Permanence and global attractivity of a stage-structured predator-prey model with continuous harvesting on predator and impulsive stocking on prey[J]. Applied Mathematics and Mechanics, 2008, 29(5): 589-600.(in Chinese) [4] 柳文清, 陈清婉. 捕食者食饵均染病的入侵反应扩散捕食系统中扩散的作用[J]. 应用数学和力学, 2019, 40(3): 321-331. (LIU Wenqing, CHEN Qingwan. Influence of diffusion on an invasion diffusion prey-predator model with disease infection in both populations[J]. Applied Mathematics and Mechanics, 2019, 40(3): 321-331.(in Chinese) [5] 刘荣, 刘桂荣. 周期环境中捕食者具有尺度结构的三物种捕食-食饵系统的最优收获[J]. 应用数学和力学, 2021, 42(5): 510-521. (LIU Rong, LIU Guirong. Optimal harvesting in a periodic 3-species predator-prey model with size structure in predators[J]. Applied Mathematics and Mechanics, 2021, 42(5): 510-521.(in Chinese) [6] WEI L, CHAO F, BOSHAN C. Hopf bifurcation for a predator-prey biological economic system with Holling type Ⅱ functional response[J]. Journal of the Franklin Institute, 2011, 348(6): 1114-1127. [7] PERC M, SZOLNOKI A, SZABO G. Cyclical interactions with alliance-specific heterogeneous invasion rates[J]. Physical Review E, 2007, 75(5): 052102. [8] PERC M, GRIGOLINI P. Collective behavior and evolutionary games: an introduction[J]. Chaos, Solitons & Fractals, 2013, 56: 1-5. [9] HOLLING C S. The functional response of predators to prey density and its role in mimicry and population regulation[J]. Memoirs of the Entomological Society of Canada, 1965, 97(45): 1-60. [10] 陈兰荪, 陈键. 非线性生物动力系统[M]. 北京: 科学出版社, 1993.CHEN Lansun, CHEN Jian. Nonlinear Biological Dynamic System[M]. Beijing: Science Press, 1993. (in Chinese) [11] 陈兰荪, 宋新宇, 陆征一. 数学生态学模型与研究方法[M]. 成都: 四川科学技术出版社, 2003.CHEN Lansun, SONG Xinyu, LU Zhengyi. Mathematical Models and Methods in Ecology[M]. Chengdu: Sichuan Science and Technology Press, 2004. (in Chinese) [12] 付胜男, 李祖雄. 一类具有状态脉冲控制的捕食-食饵模型的动力学研究[J]. 湖北民族大学学报(自然科学版), 2019, 37(1): 45-49. (FU Shengnan, LI Zuxiong. Dynamical analysis of a predator-prey model with state impulsive controlling[J]. Journal of Hubei Minzu University (Natural Science Edition), 2019, 37(1): 45-49.(in Chinese) [13] LIU Q, SHAO Y F, ZHOU S, et al. Dynamical behaviors of a three species predator-prey system with predator stage-structure and impulsive effects[J]. Chinese Journal of Engineering Mathematics, 2019, 36(2): 219-242. [14] 王克. 随机生物数学模型[M]. 北京: 科学出版社, 2010.WANG Ke. Stochastic Biological Mathematical Model[M]. Beijing: Science Press, 2010. (in Chinese) [15] KUMAR C P, REDDY K S, SRINIAVAS M. Dynamics of prey predator with Holling interactions and stochastic influences[J]. Alexandria Engineering Journal, 2017, 57(2): 1079-1086. [16] ZHANG X H, LI W X, LIU M, et al. Dynamics of a stochastic Holling Ⅱ one-predator two-prey system with jumps[J]. Physica A: Statical Mechanics and Its Applications, 2015, 421: 571-582. [17] JI C Y, JIANG D Q, SHI N Z. Analysis of a predator-prey model with modified Leslie-Gower and Holling-type Ⅱ schemes with stochastic perturbation[J]. Journal of Mathematical Analysis and Applications, 2009, 359(2): 482-498. [18] 张树文. 具Markov转换和脉冲扰动的捕食-食饵系统的动力学[J]. 数学物理学报, 2016, 36(3): 569-583. (ZHANG Shuwen. Dynamics behaviors of a predator-prey system with Markov switching and impulsive disturbance[J]. Acta Mathematica Scientia, 2016, 36(3): 569-583.(in Chinese) [19] JIANG X B, ZU L, JIANG D Q, et al. Analysis of a stochastic holling type Ⅱ predator-prey model under regime switching[J]. Bulletin of the Malaysian Mathematical Sciences Society, 2020, 43: 2171-2197. [20] AYALA F J, GILPIN M E, EHRENFELD J G. Competition between species: theoretical models and experimental tests[J]. Theoretical Population Biology, 1973, 4(3): 331-356. [21] GOPALSAMY K. Stability and Oscillations in Delay Differential Equations of Population Dynamics[M]. Mathematics and Its Applications, Vol 74. Berlin: Springer, 1992. [22] VASILOVA M. Asymptotic behavior of a stochastic Gilpin-Ayala predator-prey system with time-dependent delay[J]. Mathematical and Computer Modelling, 2013, 57(3/4): 764-781. [23] VASILOVA M, JOVANOVIC M. Stochastic Gilpin-Ayala competition model with infinite delay[J]. Applied Mathematics and Computation, 2011, 217(10): 4944-4959. [24] JIANG Y, LIU Z J, YANG J, et al. Dynamics of a stochastic Gilpin-Ayala population model with Markovian switching and impulsive perturbations[J]. Advances in Difference Equations, 2020, 2020: 530. [25] ANDERSON W J. Continuous-time Markov chains[J]. SIAM Review, 1994, 36(2): 316-317. doi: 10.1137/1036084 [26] LIU M, WANG K. Asymptotic properties and simulations of a stochastic logistic model under regime switching[J]. Mathematical and Computer Modelling, 2011, 54(9/10): 2139-2154. [27] LIU M, WANG K, WU Q. Survival analysis of stochastic competitive models in a polluted environment and stochastic competitive exclusion principle[J]. Bulletin of Mathematical Biology, 2011, 73(9): 1969-2012. [28] LIU M, WANG K. On a stochastic logistic equation with impulsive perturbations[J]. Computers and Mathematics With Applications: an International Journal, 2012, 63(5): 871-886. [29] MAO X R. Stochastic Differential Equations and Applications[M]. 2nd ed. Horwood Publishing Limited, 2007. [30] MAO X R, MARION G, RENSLAW E. Environmental Brownian noise suppresses explosions in population dynamics[J]. Stochastic Processes and Their Applications, 2002, 97(1): 95-110. [31] PANG S L, DENG F Q, MAO X R. Asymptotic properties of stochastic population dynamics[J]. Dynamics of Continuous, Discrete and Impulsive Systems (Series A): Mathematical Analysis, 2008, 15(5): 6386-6394. [32] ZHANG S Q, MENG X Z, TAO F, et al. Dynamics analysis and numerical simulations of a stochastic non-autonomous predator-prey system with impulsive effects[J]. Nonlinear Analysis: Hybrid Systems, 2017, 26: 19-37.
##### 计量
• 文章访问数: 605
• HTML全文浏览量: 324
• PDF下载量: 87
• 被引次数: 0
##### 出版历程
• 收稿日期: 2021-07-16
• 修回日期: 2022-03-05
• 网络出版日期: 2022-03-19
• 刊出日期: 2022-04-01
/
• 分享
• 用微信扫码二维码
分享至好友和朋友圈
|
assignmentutor™您的专属作业导师
assignmentutor-lab™ 为您的留学生涯保驾护航 在代写编码理论Coding theory方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写编码理论Coding theory代写方面经验极为丰富,各种代写编码理论Coding theory相关的作业也就用不着说。
• Statistical Inference 统计推断
• Statistical Computing 统计计算
• Advanced Probability Theory 高等概率论
• Advanced Mathematical Statistics 高等数理统计学
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础
## 计算机代写|编码理论代写Coding theory代考|Equivalence and Automorphisms
Two vector spaces over $\mathbb{F}_q$ are considered the same (that is, isomorphic) if there is a nonsingular linear transformation from one to the other. For linear codes to be considered the same, we want these linear transformations to also preserve weights of codewords. In Theorem 1.8.6, we will see that these weight preserving linear transformations are directly related to monomial matrices. This leads to two different concepts of code equivalence for linear codes.
Definition 1.8.1 If $P \in \mathbb{F}_q^{n \times n}$ has exactly one 1 in each row and column and 0 elsewhere, $P$ is a permutation matrix. If $M \in \mathbb{F}_q^{n \times n}$ has exactly one nonzero entry in each row and column, $M$ is a monomial matrix. If $\mathcal{C}$ is a code over $\mathbb{F}_q$ of length $n$ and $A \in$ $\mathbb{F}_q^{n \times n}$, then $\mathcal{C} A={\mathbf{c} A \mid \mathbf{c} \in \mathcal{C}}$. Let $\mathcal{C}_1$ and $\mathcal{C}_2$ be linear codes over $\mathbb{F}_q$ of length $n$. $\mathcal{C}_1$ is permutation equivalent to $\mathcal{C}_2$ provided $\mathcal{C}_2=\mathcal{C}_1 P$ for some permutation matrix $P \in \mathbb{F}_q^{n \times n} . \mathcal{C}_1$ is monomially equivalent to $\mathcal{C}_2$ provided $\mathcal{C}_2=\mathcal{C}_1 M$ for some monomial $\operatorname{matrix} M \in \mathbb{F}_q^{n \times n}$.
Remark 1.8.2 Applying a permutation matrix to a code simply permutes the coordinates; applying a monomial matrix permutes and re-scales coordinates. Applying either a permutation or monomial matrix to a vector does not change its weight. Also applying either a permutation or monomial matrix to two vectors does not change the distance between these two vectors. There is a third more general concept of equivalence, involving semi-linear transformations, where two linear codes $\mathcal{C}_1$ and $\mathcal{C}_2$ over $\mathbb{F}_q$ are equivalent provided one can be obtained from the other by permuting and re-scaling coordinates and then applying an automorphism of the field $\mathbb{F}_q$. Note that applying such maps to a vector or to a pair of vectors preserves the weight of the vector and the distance between the two vectors, respectively; see [1008, Section 1.7] for further discussion of this type of equivalence. There are other concepts of equivalence that arise when the code may not be linear but has some specific algebraic structure (e.g., additive codes over $\mathbb{F}_q$ that are closed under vector addition but not necessarily closed under scalar multiplication). The common theme when defining equivalence of such codes is to use a set of maps which preserve distance between the two vectors, which preserve the algebraic structure under consideration, and which form a group under composition of these maps. We will follow this theme when we define equivalence of unrestricted codes at the end of this section.
## 计算机代写|编码理论代写Coding theory代考|Bounds on Codes
In this section we present seven bounds relating the length, dimension or number of codewords, and minimum distnnec of an unrestricted code. The first five are considered upper bounds on the code size given length, minimum distance, and field size. By this, we mean that there does not exist a code of size bigger than the upper bound with the specified length, minimum distance, and field size. The last two are lower bounds on the size of a linear code. This means that a linear code can be constructed with the given length and minimum distance over the specified field having size equalling or exceeding the lower bound. We also give asymptotic versions of these bounds. Some of these bounds will be described using $A_q(n, d)$ and $B_q(n, d)$, which we now define.
Definition 1.9.1 For positive integers $n$ and $d, A_q(n, d)$ is the largest number of codewords in an $(n, M, d)_q$ code, linear or nonlinear. $B_q(n, d)$ is the largest number of codewords in a $[n, k, d]_q$ linear code. An $(n, M, d)_q$ code is optimal provided $M=A_q(n, d)$; an $[n, k, d]_q$ linear code is optimal if $q^k=B_q(n, d)$. The concept of ‘optimal’ can also be used in other contexts. Given $n$ and $d, k_q(n, d)$ denotes the largest dimension of a linear code over $\mathbb{F}_q$ of length $n$ and minimum weight $d$; an $\left[n, k_q(n, d), d\right]_q$ code could be called ‘optimal in dimension’. Notice that $k_q(n, d)=\log _q B_q(n, d)$. Similarly, $d_q(n, k)$ denotes the largest minimum distance of a linear code over $\mathbb{F}_q$ of length $n$ and dimension $k$; an $\left[n, k, d_q(n, k)\right]_q$ may be called ‘optimal in distance’. Analogously, $n_q(k, d)$ denotes the smallest length of a linear code over $\mathbb{F}_q$ of dimension $k$ and minimum weight $d$; an $\left[n_q(k, d), k, d\right]_q$ code might be called ‘optimal in length’. 5
Clearly $B_q(n, d) \leq A_q(n, d)$. On-line tables relating parameters of various types of codes are maintained by M. Grassl [845].
The following basic properties of $A_q(n, d)$ and $B_q(n, d)$ are easily derived; see [1008, Chapter 2.1].
# 编码理论代考
## 有限元方法代写
assignmentutor™作为专业的留学生服务机构,多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务,包括但不限于Essay代写,Assignment代写,Dissertation代写,Report代写,小组作业代写,Proposal代写,Paper代写,Presentation代写,计算机作业代写,论文修改和润色,网课代做,exam代考等等。写作范围涵盖高中,本科,研究生等海外留学全阶段,辐射金融,经济学,会计学,审计学,管理学等全球99%专业科目。写作团队既有专业英语母语作者,也有海外名校硕博留学生,每位写作老师都拥有过硬的语言能力,专业的学科背景和学术写作经验。我们承诺100%原创,100%专业,100%准时,100%满意。
## MATLAB代写
MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中,其中问题和解决方案以熟悉的数学符号表示。典型用途包括:数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发,包括图形用户界面构建MATLAB 是一个交互式系统,其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题,尤其是那些具有矩阵和向量公式的问题,而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问,这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展,得到了许多用户的投入。在大学环境中,它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域,MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要,工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数(M 文件)的综合集合,可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。
assignmentutor™您的专属作业导师
assignmentutor™您的专属作业导师
|
(1) 已知二次函数 $f(x)$ 满足条件 $f(0)=1$ 及 $f(x+1)-f(x)=2 x$, 求 $f(x)$.
(2) 若 $f(x)$ 满足关系式 $f(x)+2 f\left(\frac{1}{x}\right)=3 x$, 求 $f(x)$.
$\because f(x+1)-f(x)=2x$
,
$\therefore\left\{\begin{array}{c}2 a=2 \\ a+b=0\end{array}\right.$, 解得: $\left\{\begin{array}{c}a=1 \\ b=-1\end{array}\right.$,
$\therefore f(x)=x^2-x+1$;
(2) $\because f(x)+2 f\left(\frac{1}{x}\right)=3 x$ ①,
$\therefore f\left(\frac{1}{x}\right)+2 f(x)=\frac{3}{x}②$,
①②组成方程组, 解得: $f(x)=\frac{2}{x}-x$.
|
### 金融代写|利率建模代写Interest Rate Modeling代考|MATH5985
Vasicek利率模型一词是指一种对利率的运动和演变进行建模的数学方法。它是一种基于市场风险的单因素短利率模型。瓦西克利率模型常用于经济学中,以确定利率在未来的移动方向。
statistics-lab™ 为您的留学生涯保驾护航 在代写利率建模Interest Rate Modeling方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写利率建模Interest Rate Modeling代写方面经验极为丰富,各种代写利率建模Interest Rate Modeling相关的作业也就用不着说。
• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础
## 金融代写|利率建模代写Interest Rate Modeling代考|The Martingale Representation Theorem
The martingale representation theorem plays a critical role in the so-called martingale approach to derivatives pricing. This theorem has two important
consequences. First, it leads to a general principle for derivatives pricing. Second, it implies a replication or hedging strategy of a derivative using its underlying security. We first present a simple version of the theorem based on a single Brownian filtration, $\mathcal{F}{t}=\sigma\left(W{s}, 0 \leq s \leq t\right)$. We begin with a martingale process, $M_{t}$, such that
$$\mathrm{d} M_{t}=\sigma_{t} \mathrm{~d} W_{t},$$
and we call $\sigma_{t}$ the volatility of $M_{t}$.
Theorem 2.3.1 (The Martingale Representation Theorem). Suppose that $N_{t}$ is a $\mathbb{Q}$-martingale process that is adaptive to $\mathcal{F}{t}$ and satisfies $E^{\mathbb{Q}}\left[N{T}^{2}\right]<$ $\infty$ for some T. If the volatility of $M_{t}$ is non-zero almost surely, then there exists a unique $\mathcal{F}{t}-$ adaptive process, $\varphi{t}$, such that $E^{Q}\left[\int_{0}^{T} \varphi_{t}^{2} \sigma_{t}^{2} d t\right]<\infty$ almost surely, and
$$N_{t}=N_{0}+\int_{0}^{t} \varphi_{s} d M_{s}, \quad t \leq T$$
or, in differential form,
$$d N_{t}=\varphi_{t} d M_{t}$$
The proof combining the techniques of Steele $(2000)$ and $Ø k s e n d a l ~(2003)$ is provided in the appendix of this chapter. A different proof can be found in Korn and Korn (2000).
## 金融代写|利率建模代写Interest Rate Modeling代考|A Complete Market with Two Securities
We consider the first “complete market” in continuous time, which consists of a money market account and a risky security. The price processes for the two securities, $B_{t}$ and $S_{t}$, are assumed to be
\begin{aligned} \mathrm{d} B_{t} &=r_{t} B_{t} \mathrm{~d} t, & & B_{0}=1 \ \mathrm{~d} S_{t} &=S_{t}\left(\mu_{t} \mathrm{~d} t+\sigma_{t} \mathrm{~d} W_{t}\right), & S_{0} &=S_{0} \end{aligned}
Here, the volatility of the risky asset is $\sigma_{t} \neq 0$ almost surely, and the short rate, $r_{t}$, can be stochastic. Denote the discounted price of the risky asset as $Z_{t}=B_{t}^{-1} S_{t}$, which can be shown to follow the process
\begin{aligned} \mathrm{d} Z_{t} &=Z_{t}\left(\left(\mu_{t}-r_{t}\right) \mathrm{d} t+\sigma_{t} \mathrm{~d} W_{t}\right) \ &=Z_{t} \sigma_{t} \mathrm{~d}\left(W_{t}+\int_{0}^{t} \frac{\left(\mu_{s}-r_{s}\right)}{\sigma_{s}} \mathrm{~d} s\right) \end{aligned}
By introducing
$$\gamma_{t}=\frac{\mu_{t}-r_{t}}{\sigma_{t}}$$
which is $\mathcal{F}{t}$-adaptive, and by defining a new measure, Q, according to Equation $2.36$, we have $$\tilde{W}{t}=W_{t}+\int_{0}^{t} \gamma_{s} \mathrm{~d} s,$$
which is a Q-Brownian motion. In terms of $\tilde{W}{t}, Z{t}$ satisfies
$$\mathrm{d} Z_{t}=\sigma_{t} Z_{t} \mathrm{~d} \tilde{W}_{t},$$
which is a lognormal Q-martingale. Recall that in the binomial model for option pricing, we also derived the martingale measure for the underlying security.
## 金融代写|利率建模代写Interest Rate Modeling代考|Replicating and Pricing of Contingent Claims
Let $X_{T}$ be a contingent claim (or option) with payoff day or maturity $T$. The claim is an $\mathcal{F}{T}$-adaptive function whose value depends on $\left{S{t}, 0 \leq t \leq T\right}$. Define first a $\mathbb{Q}$-martingale with the discounted payoff:
$$N_{t}=E^{Q}\left(B_{T}^{-1} X_{T} \mid \mathcal{F}{t}\right) .$$ Without loss of generality, we assume that $E^{\mathrm{Q}}\left[N{t}^{2}\right]<\infty$. According to the martingale representation theorem, there exists an $\mathcal{F}{t}$-adaptive function, $\varphi{t}$, such that
$$\mathrm{d} N_{t}=\varphi_{t} \mathrm{~d} Z_{t},$$
where $Z_{t}$, defined in the last section, is the discounted price of $S_{t}$. Next, we define
$$\psi_{t}=N_{t}-\varphi_{t} Z_{t} .$$
Consider now the portfolio with $\varphi_{t}$ units of the stock and $\psi_{t}$ units of the money market account, denoted as $\left(\varphi_{t}, \psi_{t}\right)$. According to the definition of $\psi_{t}$, the discount value of the replication portfolio is
$$\tilde{V}{t}=\varphi{t} Z_{t}+\psi_{t}=N_{t}$$
This portfolio has two important properties. First, at time $T$, when the option matures,
$$\tilde{V}{T}=N{T}=B_{T}^{-1} X_{T}$$
which suggests that the (discounted) value of the portfolio equals that of the option. In other words, the portfolio replicates the payoff of the contingent claim. Second, the replicating portfolio is a self-financing one, meaning that it can track the asset allocation, $\left(\varphi_{t}, \psi_{t}\right)$, without the need for either capital
infusion or capital withdrawal. In fact, based on Equations $2.45$ and $2.47$, we have
$$\mathrm{d} \tilde{V}{t}=\mathrm{d} N{t}=\varphi_{t} \mathrm{~d} Z_{t}$$
In terms of the spot value, $B_{t}$ and $S_{t}$, Equation $2.49$ becomes
\begin{aligned} \mathrm{d} V_{t} &=\mathrm{d}\left(\tilde{V}{t} B{t}\right) \ &=B_{t} \mathrm{~d} \tilde{V}{t}+\tilde{V}{t} \mathrm{~d} B_{t} \ &=B_{t} \varphi_{t} \mathrm{~d} Z_{t}+\left(\varphi_{t} Z_{t}+\psi_{t}\right) \mathrm{d} B_{t} \ &=\varphi_{t}\left(B_{t} \mathrm{~d} Z_{t}+Z_{t} \mathrm{~d} B_{t}\right)+\psi_{t} \mathrm{~d} B_{t} \ &=\varphi_{t} \mathrm{~d}\left(B_{t} Z_{t}\right)+\psi_{t} \mathrm{~d} B_{t} \ &=\varphi_{t} \mathrm{~d} S_{t}+\psi_{t} \mathrm{~d} B_{t} \end{aligned}
A direct consequence of the above equation is the equality
\begin{aligned} \varphi_{t+d t} S_{t+d t}+\psi_{t+d t} B_{t+d t} &=\varphi_{t} S_{t}+\psi_{t} B_{t}+\varphi_{t} \mathrm{~d} S_{t}+\psi_{t} \mathrm{~d} B_{t} \ &=\varphi_{t} S_{t+d t}+\psi_{t} B_{t+d t}, \end{aligned}
## 金融代写|利率建模代写Interest Rate Modeling代考|The Martingale Representation Theorem
d米吨=σ吨 d在吨,
ñ吨=ñ0+∫0吨披sd米s,吨≤吨
dñ吨=披吨d米吨
## 金融代写|利率建模代写Interest Rate Modeling代考|A Complete Market with Two Securities
d乙吨=r吨乙吨 d吨,乙0=1 d小号吨=小号吨(μ吨 d吨+σ吨 d在吨),小号0=小号0
d从吨=从吨((μ吨−r吨)d吨+σ吨 d在吨) =从吨σ吨 d(在吨+∫0吨(μs−rs)σs ds)
C吨=μ吨−r吨σ吨
d从吨=σ吨从吨 d在~吨,
## 金融代写|利率建模代写Interest Rate Modeling代考|Replicating and Pricing of Contingent Claims
ñ吨=和问(乙吨−1X吨∣F吨).不失一般性,我们假设和问[ñ吨2]<∞. 根据鞅表示定理,存在一个F吨-自适应功能,披吨, 这样
dñ吨=披吨 d从吨,
ψ吨=ñ吨−披吨从吨.
$$\tilde{V} {T}=N {T}=B_{T}^{-1} X_{T}$$
d在~吨=dñ吨=披吨 d从吨
d在吨=d(在~吨乙吨) =乙吨 d在~吨+在~吨 d乙吨 =乙吨披吨 d从吨+(披吨从吨+ψ吨)d乙吨 =披吨(乙吨 d从吨+从吨 d乙吨)+ψ吨 d乙吨 =披吨 d(乙吨从吨)+ψ吨 d乙吨 =披吨 d小号吨+ψ吨 d乙吨
## 有限元方法代写
tatistics-lab作为专业的留学生服务机构,多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务,包括但不限于Essay代写,Assignment代写,Dissertation代写,Report代写,小组作业代写,Proposal代写,Paper代写,Presentation代写,计算机作业代写,论文修改和润色,网课代做,exam代考等等。写作范围涵盖高中,本科,研究生等海外留学全阶段,辐射金融,经济学,会计学,审计学,管理学等全球99%专业科目。写作团队既有专业英语母语作者,也有海外名校硕博留学生,每位写作老师都拥有过硬的语言能力,专业的学科背景和学术写作经验。我们承诺100%原创,100%专业,100%准时,100%满意。
## MATLAB代写
MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中,其中问题和解决方案以熟悉的数学符号表示。典型用途包括:数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发,包括图形用户界面构建MATLAB 是一个交互式系统,其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题,尤其是那些具有矩阵和向量公式的问题,而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问,这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展,得到了许多用户的投入。在大学环境中,它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域,MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要,工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数(M 文件)的综合集合,可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。
|
ZOJ3203 Light Bulb[三分/推公式]
Light Bulb
Time Limit:1000MS Memory Limit:32768KB
Description
Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommodious house, thinking of how to earn more money. One day, he found that the length of his shadow was changing from time to time while walking between the light bulb and the wall of his house. A sudden thought ran through his mind and he wanted to know the maximum length of his shadow.
Input
The first line of the input contains an integer T (T <= 100), indicating the number of cases.
Each test case contains three real numbers Hh and D in one line. H is the height of the light bulb while h is the height of mildleopard. D is distance between the light bulb and the wall. All numbers are in range from 10-2 to 103, both inclusive, and H - h >= 10-2.
Output
For each test case, output the maximum length of mildleopard's shadow in one line, accurate up to three decimal places.
Sample Input
3
2 1 0.5
2 0.5 3
4 3 4
Sample Output
1.000
0.750
4.000
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
const double esp=1e-8;
double H,h,D;
double cal(double x)
{
return D-x+H-(H-h)*D/x;
}
double three_devide(double l,double r)
{
double left=l,right=r,mid,midmid;
while (left+esp<right)
{
mid=(right+left)/2;
midmid=(right+mid)/2;
if (cal(mid)>=cal(midmid))
right=midmid;
else
left=mid;
}
return cal(right);
}
int main()
{
int T;
scanf("%d",&T);
while (T--)
{
scanf("%lf%lf%lf",&H,&h,&D);
double l=D-h*D/H,r=D;
double ans=three_devide(D-h*D/H,r);
printf("%.3f\n",ans);
}
return 0;
}
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
const double esp=1e-8;
double H,h,D;
int main()
{
int T;
scanf("%d",&T);
while (T--)
{
scanf("%lf%lf%lf",&H,&h,&D);
double mx=D-h*D/H;
if (D>=sqrt((H-h)*D) && mx<=sqrt((H-h)*D))
mx=D+H-2*sqrt((H-h)*D);
else if (sqrt((H-h)*D)<mx)
mx=h*D/H;
else
mx=h;
printf("%.3lf\n",mx);
}
return 0;
}
[作为还是渣渣的我,今年第一次给新生讲座讲二分三分,就来写写了,好紧张,导致自己讲的特别糟糕,感觉效果也不怎么好,不过,还是第一次这样呢,希望还能继续这条路.要开始继续努力的写题了,为了不让自己留下遗憾!]
|
# 小学生都能看懂的生成函数入门教程
## 生成函数
### 普通生成函数
f[0][0] = 1;
for(int i = 1; i <= 3; i++)
for(int j = 0; j <= 8; j++) //当前总共要选出j个
for(int k = 0; k <= j; k++) //已经选了k个
if(j - k <= v[i]) //此时要选j-k个
f[i][j] += f[i - 1][k];
\begin{aligned} G(x) &= (1+x+x^2+x^3)(1+x+x^2)(1+x+x^2+x^3) \\ &= (1+2x+3x^2+3x^3+2x^4+x^5)(1+x+x^2+x^3)\\ &=1+3x+6x^2+9x^3+10x^4+9x^5+6x^6+3x^7+x^8 \end{aligned}
$x_1x_3^3+x_2x_3^3+x_1^2x_3^2+x_1x_2x_3^2+x_2^2x_3^2+x_1^3x_3+x_1^2x_2x_3+x_1x_2^2x_3+x_1^3x_3+x_1^2x_2^2$
## 指数生成函数
$S = \{a_1, a_2 \dots a_n\}, N = \sum_{i=1}^n a_i$,其中第$a_i$表示第$i$个物品有$a_i$个。
$x_1x_3^3+x_2x_3^3+x_1^2x_3^2+x_1x_2x_3^2+x_2^2x_3^2+x_1^3x_3+x_1^2x_2x_3+x_1x_2^2x_3+x_1^3x_3+x_1^2x_2^2$
$G_2(x) = 1 + \frac{x^1}{1} + \frac{x^2}{2}$
$G_3(x) = 1 + \frac{x^1}{1} + \frac{x^2}{2!} + \frac{x^3}{3!}$
\begin{aligned} G_e(x) &= (1 + \frac{x}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!})(1+\frac{x}{1!} + \frac{x^2}{2!}) (1 + \frac{x}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!})\\ &= (1+2x+2x^2+\frac{7}{6}x^3 + \frac{5}{12}x^4 + \frac{1}{12}x^5) (1+x+\frac{1}{2}x^2 + \frac{1}{6}x^3)\\ &=(1+3x + \frac{9}{2}x^2 + \frac{14}{3}x^3 + \frac{35}{12}x^4 + \frac{17}{12}x^5 + \frac{35}{72} x^6 + \frac{8}{72}x^7 + \frac{1}{71}x^8) \end{aligned}
## 普通生成函数的推广
### 简单介绍
$S = 1 + x + x^2 + \dots x^{\infty}$
$xS = x + x^2 + x^3 + \dots x^{\infty}$
$S - xS = 1$
$S = \frac{1}{1-x}$
• $x$替换为$-x$$\frac{1}{1+x} = {1, -1, 1, -1, \dots}$
• $x$替换为$2x$$\ \frac{1}{1-2x} = {1, 2, 4, 8, 16, \dots}$
• $x$替换为$x^2$, $\ \ \ \frac{1}{1-x^2} = {1, 0, 1, 0, 1 \dots}$
• 将分子乘$2$, $\ \ \ \ \quad\frac{2}{1-x} = {2, 2, 2, 2, 2, \dots}$
• 将分子乘$x^3$, $\ \ \quad \frac{x^3}{1-x} \ = {0, 0, 0, 1, 1, 1, 1 \dots}$
• 求个导, $\qquad \ \ \ \ \ \frac{1}{(1-x)^2} = {1, 2, 3, 4, 5} \dots$
• 再求一次, $\quad \ \ \ \frac{2}{(1-x)^3} ={2 + 6 + 12 + 20 \dots}$
$\frac{1}{(1-x)^n} = \sum_{k=0}^{\infty} C_{n+k-1}^{k-1} x^k$
### 求斐波那契数列通项公式
$f_i = f_{i-1} + f_{i - 2}$
$f_0 = f_1 = 1$
$A = 1 + 1x + 2x^2 + 3x^3 + 5x^4 + 8x^5 \dots$
\begin{aligned} A = \ 1 + 1x + &2x^2 + 3x^3 + 5x^4 + 8x^5 \dots \\ xA = \ \ \qquad x + &1x^2 + 2x^3 + 3x^4 + 5x^5\dots \\ x^2A =\qquad \qquad &1x^2 + 1x^3 + 2x^4 + 3x^5 \dots \end{aligned}
$\frac{1}{1-x-x^2}$这玩意儿下半部分是个一元二次方程,我们可以配方
$1-x-x^2 = (1-\phi_1x)(1-\phi_2x)$
$\phi_1 = \frac{1+\sqrt{5}}{2}, \phi_2 = \frac{1-\sqrt{5}}{2}$
(解的时候可以直接把后面的式子拆开,把这两个式子对应项联立组成方程组, $\phi_1 \phi_2$的取值是可以反过来的)
$(a+b - 1) - x(a\phi_2 + b\phi_1) = 0$
$\begin{cases} a+b-1 = 0\\ a\phi_2 + b\phi_1 = 0 \end{cases}$
$A = \frac{\phi_1}{\sqrt{5}} \frac{1}{1-\phi_1x} - \frac{\phi_2}{\sqrt{5}} \frac{1}{1-\phi_2x}$
$A_n = \frac{1}{\sqrt{5}} ((\frac{1+\sqrt{5}}{2})^{n+1} - (\frac{1-\sqrt{5}}{2})^{n+1})$
### 解决组合类问题
$k$的倍数就是$\frac{1}{1-x^k}$
## 指数生成函数的推广
$e^x = \sum_{i=0}^{\infty} \frac{x^i}{i!}$
• $e^{-x} = 1 - \frac{x}{1} + \frac{x}{2!} -\frac{x}{3!} + \frac{x}{4!}\dots$
• $\frac{e^x + e^{-x}}{2} = 1 + \frac{x^2}{2!} + \frac{x^4}{4!} + \frac{x^6}{6!}\dots$
• $\frac{e^x - e^{-x}}{2} = \frac{x}{1} + \frac{x^3}{3!} + \frac{x^5}{5!} + \frac{x^7}{7!}$
• $e^{kx} = 1 + \frac{kx}{1} + \frac{k^2x^2}{2!} + \frac{k^3x^3}{3!} + \frac{k^4x^4}{4!} \dots$
### 一道简单的题目
$n \leqslant 10^9$
## 参考资料
posted @ 2019-03-13 10:58 自为风月马前卒 阅读(...) 评论(...编辑 收藏
……
|
# 2.3.1: Numbers (模块一- 数字)
$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$
$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$
$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$
( \newcommand{\kernel}{\mathrm{null}\,}\) $$\newcommand{\range}{\mathrm{range}\,}$$
$$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$
$$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$
$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$
$$\newcommand{\Span}{\mathrm{span}}$$
$$\newcommand{\id}{\mathrm{id}}$$
$$\newcommand{\Span}{\mathrm{span}}$$
$$\newcommand{\kernel}{\mathrm{null}\,}$$
$$\newcommand{\range}{\mathrm{range}\,}$$
$$\newcommand{\RealPart}{\mathrm{Re}}$$
$$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$
$$\newcommand{\Argument}{\mathrm{Arg}}$$
$$\newcommand{\norm}[1]{\| #1 \|}$$
$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$
$$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$
$$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$
$$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$
$$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$
$$\newcommand{\vectorC}[1]{\textbf{#1}}$$
$$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$
$$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$
$$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$
$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$
$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$
$$\newcommand{\avec}{\mathbf a}$$ $$\newcommand{\bvec}{\mathbf b}$$ $$\newcommand{\cvec}{\mathbf c}$$ $$\newcommand{\dvec}{\mathbf d}$$ $$\newcommand{\dtil}{\widetilde{\mathbf d}}$$ $$\newcommand{\evec}{\mathbf e}$$ $$\newcommand{\fvec}{\mathbf f}$$ $$\newcommand{\nvec}{\mathbf n}$$ $$\newcommand{\pvec}{\mathbf p}$$ $$\newcommand{\qvec}{\mathbf q}$$ $$\newcommand{\svec}{\mathbf s}$$ $$\newcommand{\tvec}{\mathbf t}$$ $$\newcommand{\uvec}{\mathbf u}$$ $$\newcommand{\vvec}{\mathbf v}$$ $$\newcommand{\wvec}{\mathbf w}$$ $$\newcommand{\xvec}{\mathbf x}$$ $$\newcommand{\yvec}{\mathbf y}$$ $$\newcommand{\zvec}{\mathbf z}$$ $$\newcommand{\rvec}{\mathbf r}$$ $$\newcommand{\mvec}{\mathbf m}$$ $$\newcommand{\zerovec}{\mathbf 0}$$ $$\newcommand{\onevec}{\mathbf 1}$$ $$\newcommand{\real}{\mathbb R}$$ $$\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}$$ $$\newcommand{\laspan}[1]{\text{Span}\{#1\}}$$ $$\newcommand{\bcal}{\cal B}$$ $$\newcommand{\ccal}{\cal C}$$ $$\newcommand{\scal}{\cal S}$$ $$\newcommand{\wcal}{\cal W}$$ $$\newcommand{\ecal}{\cal E}$$ $$\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}$$ $$\newcommand{\gray}[1]{\color{gray}{#1}}$$ $$\newcommand{\lgray}[1]{\color{lightgray}{#1}}$$ $$\newcommand{\rank}{\operatorname{rank}}$$ $$\newcommand{\row}{\text{Row}}$$ $$\newcommand{\col}{\text{Col}}$$ $$\renewcommand{\row}{\text{Row}}$$ $$\newcommand{\nul}{\text{Nul}}$$ $$\newcommand{\var}{\text{Var}}$$ $$\newcommand{\corr}{\text{corr}}$$ $$\newcommand{\len}[1]{\left|#1\right|}$$ $$\newcommand{\bbar}{\overline{\bvec}}$$ $$\newcommand{\bhat}{\widehat{\bvec}}$$ $$\newcommand{\bperp}{\bvec^\perp}$$ $$\newcommand{\xhat}{\widehat{\xvec}}$$ $$\newcommand{\vhat}{\widehat{\vvec}}$$ $$\newcommand{\uhat}{\widehat{\uvec}}$$ $$\newcommand{\what}{\widehat{\wvec}}$$ $$\newcommand{\Sighat}{\widehat{\Sigma}}$$ $$\newcommand{\lt}{<}$$ $$\newcommand{\gt}{>}$$ $$\newcommand{\amp}{&}$$ $$\definecolor{fillinmathshade}{gray}{0.9}$$
Scenario 1.1
Li Ming and An Dawei exchange their cell phone numbers.
LM: AD: LM: 大为,你的手机号码是多少? 我的是130-7417-8495。 你的呢? 我的是136-2266-5188。 手机 shǒujī cell phone 号码 hàomǎ number 多少 duōshǎo how many, how much 呢 ne (particle)
Note:
Number “0” is pronounced “líng.” Number “1” sometimes can be pronounced as “yāo” in phone numbers.
Phone Number To read a phone number in Chinese, you will read the digits of the phone number one by one. For example,
136-2266-5188 is pronounced “yāo sān liù, èr èr liù liù, wǔ yāo bā bā.”
Scenario 1.2
Li Ming asks An Dawei how many siblings he has.
LM: AD: LM: 大为,你有几个哥哥? 我有一个。你呢? 我没有哥哥,可是有一个姐姐。 没有 méiyǒu don’t have 可是 kěshì but 姐姐 jiějiě older sister
Scenario 1.3
Li Ming asks An Dawei how many students are in his Chinese class.
LM: AD: 大为,你的中文课有多少(个)学生? 十五个。八个男生,七个女生。 中文 zhōngwén Chinese language 课 kè class, course 学生 xuéshēng student 男生 nánshēng male student 女生 nǚshēng female student
Note:
This page titled 2.3.1: Numbers (模块一- 数字) is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by .
|
216人阅读 评论(0)
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
p = 0
result = None
current = None
while True:
addValue = l1.val + l2.val + p
p = 0
p = 1
if result == None:
result = node
current = node
else:
current.next = node
current = node
l1 = l1.next
l2 = l2.next
if l1 == None or l2 == None:
break
if l1 == None and l2 == None:
pass
elif l1 == None or l2 == None:
rest = None
if l1 == None:
rest = l2
else :
rest = l1
while True:
p = 0
p = 1
current.next = node
current = node
rest = rest.next
if rest == None:
break
if p == 0:
return result
else:
node = ListNode(p)
current.next = node
return result
0
0
个人资料
• 访问:122075次
• 积分:2649
• 等级:
• 排名:第16266名
• 原创:136篇
• 转载:56篇
• 译文:0篇
• 评论:36条
博客专栏
Spring Boot Demos 文章:0篇 阅读:0
|
基于全站仪交会测量的空间距离校准装置测量方法
文章快速检索 高级检索
大地测量与地球动力学 2020, Vol. 40 Issue (9): 985-990 DOI: 10.14075/j.jgg.2020.09.021
### 引用本文
PENG Youzhi, ZHANG Xin, HE Haopeng. A Measuring Method for Space Distance Calibration Field Based on Total Station Intersection Survey[J]. Journal of Geodesy and Geodynamics, 2020, 40(9): 985-990.
### Foundation support
Scientific Research Fund of Institute of Seismology and Institute of Crustal Dynamics, CEA, No.IS20176253.
### 第一作者简介
PENG Youzhi, engineer, majors in metrological calibration of geodetic instruments, E-mail: 8452590@qq.com.
### 文章历史
1. 中国地震局地震研究所地震大地测量重点实验室, 武汉市洪山侧路40号,430071;
2. 武汉地震计量检定与测量工程研究院有限公司,武汉市洪山侧路40号,430071
1 测量方法与数据处理 1.1 整体思路
图 1 测量及数据处理流程 Fig. 1 Flow chart of measurement and data processing
1.2 测量方法
图 2 平面式空间距离标准装置测量方法布置示意图 Fig. 2 Schematic layout of measurement method for plane space distance standard device
$\left\{ \begin{array}{l} R = \frac{{{\rm{sin}}\alpha /2}}{{1 - {\rm{sin}}\alpha /2}}L{\rm{sin}}V\\ x = {x_i} + (R + L){\rm{sin}}V{\rm{cos}}{H_z}\\ y = {y_i} + (R + L){\rm{sin}}V{\rm{cos}}{H_z}\\ z = {z_i} + (R + L){\rm{cos}}V \end{array} \right.$ (1)
1.3 整体平差与精度估计
${x_P} = {X_P} - X_P^0, {y_P} = {Y_P} - Y_P^0, {z_P} = {Z_P} - Z_P^0$
$\begin{array}{l} {\rm{tan}}{A_{mn}} = \frac{{{X_n} - {X_m}}}{{{Y_n} - {Y_m}}} \Rightarrow {\rm{tan}}{A_{mn}}\left( {{y_n} - {y_m}} \right) - \\ \;\;\;\;\;\;\;\left( {{x_n} - {x_m}} \right) = \Delta X_{mn}^0 - \Delta Y_{mn}^0{\rm{tan}}{A_{mn}} \end{array}$
$\begin{array}{l} \;\;\;\;\;\;\;\;\;{\rm{tan}}\left( {\frac{\pi }{2} - {A_{mn}}} \right) = \frac{{{Y_n} - {Y_m}}}{{{X_n} - {X_m}}} \Rightarrow \\ {\rm{tan}}\left( {\frac{\pi }{2} - {A_{mn}}} \right)\left( {{x_n} - {x_m}} \right) - \left( {{y_n} - {y_m}} \right) = \\ \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\Delta Y_{mn}^0 - \Delta X_{mn}^0{\rm{tan}}\left( {\frac{\pi }{2} - {A_{mn}}} \right) \end{array}$
1) 水平方向观测值:
${\widehat{L}}_{mn}={\rm arctan}\left(\frac{{\widehat{X}}_{n}-{\widehat{X}}_{m}}{{\widehat{Y}}_{n}-{\widehat{Y}}_{m}}\right)-{\widehat{\rm{SA}}}_{k}$ (2a)
2) 天顶距观测值:
$\begin{array}{l} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{{\hat T}_{mn}} = \frac{\pi }{2} - \\ {\rm{arctan}}\left( {\frac{{{{\hat Z}_n} - {{\hat Z}_m}}}{{\sqrt {{{\left( {{{\hat X}_n} - {{\hat X}_m}} \right)}^2} + {{\left( {{{\hat Y}_n} - {{\hat Y}_m}} \right)}^2}} }}} \right) \end{array}$ (2b)
3) 起始方位角差观测值:
${\widehat {{\rm{DA}}}_{kl}} = {\widehat {{\rm{SA}}}_k} - {\widehat {{\rm{SA}}}_l}$ (2c)
4) 距离观测值:
$\begin{array}{l} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{{\hat S}_{{{mn}}}} = \\ \sqrt {{{\left( {{{\hat X}_n} - {{\hat X}_m}} \right)}^2} + {{\left( {{{\hat Y}_n} - {{\hat Y}_m}} \right)}^2} + {{\left( {{{\hat Z}_n} - {{\hat Z}_m}} \right)}^2}} \end{array}$ (2d)
$\left\{ \begin{array}{l} {V_{L_{mn}}} = \frac{{\Delta X_{mn}^0}}{{{{\left( {{\rm{SH}}_{mn}^0} \right)}^2}}}{y_m} - \frac{{\Delta Y_{mn}^0}}{{{{\left( {{\rm{SH}}_{mn}^0} \right)}^2}}}{x_m} - \\ \;\;\;\frac{{\Delta X_{mn}^0}}{{{{\left( {{\rm{SH}}_{mn}^0} \right)}^2}}}{y_n} + \frac{{\Delta Y_{mn}^0}}{{{{\left( {{\rm{SH}}_{mn}^0} \right)}^2}}}{x_n} - {a_k} - {l_{mn}} + \\ \;\;\;{\rm{arctan}}\left( {\frac{{\Delta X_{mn}^0}}{{\Delta Y_{mn}^0}}} \right) - SA_k^0\\ {V_{T_{mn}}} = \frac{{\Delta Z_{mn}^0\Delta X_{mn}^0}}{{{{\left( {S_{mn}^0} \right)}^2}{\rm{SH}}_{mn}^0}}{x_n} - \frac{{\Delta Z_{mn}^0\Delta X_{mn}^0}}{{{{\left( {S_{mn}^0} \right)}^2}{\rm{SH}}_{mn}^0}}{x_m} + \\ \;\;\;\frac{{\Delta Z_{mn}^0\Delta Y_{mn}^0}}{{{{\left( {S_{mn}^0} \right)}^2}{\rm{SH}}_{mn}^0}}{y_n} - \frac{{\Delta Z_{mn}^0\Delta Y_{mn}^0}}{{{{\left( {S_{mn}^0} \right)}^2}{\rm{SH}}_{mn}^0}}{y_m} - \\ \;\;\;\frac{{{\rm{SH}}_{mn}^0}}{{{{\left( {S_{mn}^0} \right)}^2}}}{z_n} + \frac{{{\rm{SH}}_{mn}^0}}{{{{\left( {S_{mn}^0} \right)}^2}}}{z_m} + \frac{\pi }{2} - \\ \;\;\;\;{\rm{arctan}}\left( {\frac{{\Delta Z_{mn}^0}}{{{\rm{SH}}_{mn}^0}}} \right) - {t_{mn}}\\ {V_{{\rm{d}}{{\rm{a}}_{kl}}}} = {a_k} - {a_l} + A_k^0 - A_l^0 - {\rm{d}}{{\rm{a}}_{kl}}\\ {V_{{S_{mn}}}} = \frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}{x_n} - \frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}{x_m} + \frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}{y_n} - \\ \;\;\;\;\;\;\;\frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}{y_m} + \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}{z_n} - \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}{z_m} + S_{mn}^0 - {{\rm{s}}_{mn}} \end{array} \right.$ (3)
$\mathit{\boldsymbol{V}} = \mathit{\boldsymbol{Bx}} + \mathit{\boldsymbol{l}}$ (4)
$\begin{array}{l} \mathit{\boldsymbol{x}} = ({x_1}\;\;{y_1}\;\;{z_1}\;\;{x_2}\;\;{y_2}\;\;{z_2}\;\; \cdots \\ \;\;\;\;\;\;\;\;\;{x_N}\;\;{y_N}\;\;{z_N}\;\;{a_{k1}}\;\;{a_{k2}}\; \cdots \;\;{a_{kM}}{)^{\rm{T}}} \end{array}$
$\mathit{\boldsymbol{Gx}} = \mathit{\boldsymbol{t}}$
G作奇异值分解(SVD):
$\mathit{\boldsymbol{G}} = \mathit{\boldsymbol{U \boldsymbol{\varLambda} }}{\mathit{\boldsymbol{H}}^{\rm{T}}} = \left( {{\mathit{\boldsymbol{U}}_{{r}}}} \right)\left( {\begin{array}{*{20}{c}} {{\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}_r}}&{{\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}_0}} \end{array}} \right){\left( {\begin{array}{*{20}{c}} {{\mathit{\boldsymbol{H}}_r}}&{{\mathit{\boldsymbol{H}}_0}} \end{array}} \right)^{\rm{T}}}$
$\mathit{\boldsymbol{x}} = {\mathit{\boldsymbol{H}}_0}\mathit{\boldsymbol{y}} + \mathit{\boldsymbol{w}}$
$\mathit{\boldsymbol{w}} = {\mathit{\boldsymbol{H}}_r}\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}_r^{ - 1}\mathit{\boldsymbol{U}}_r^{\rm{T}}\mathit{\boldsymbol{t}}$
$\begin{array}{l} \;\;\;\;\;\;\;\;\;\;\;\;\;\mathit{\boldsymbol{V}} = \mathit{\boldsymbol{B}}{\mathit{\boldsymbol{H}}_0}\mathit{\boldsymbol{y}} + \mathit{\boldsymbol{Bw}} + \mathit{\boldsymbol{l}}\\ \mathop {{\rm{min}}}\limits_\mathit{\boldsymbol{y}} {\mathit{\boldsymbol{V}}^{\rm{T}}}\mathit{\boldsymbol{PV}} = - {\left( {{\mathit{\boldsymbol{H}}_0}^{\rm{T}}{\mathit{\boldsymbol{B}}^{\rm{T}}}\mathit{\boldsymbol{PB}}{\mathit{\boldsymbol{H}}_0}} \right)^{ - 1}}{\mathit{\boldsymbol{H}}_0}^{\rm{T}}{\mathit{\boldsymbol{B}}^{\rm{T}}}\mathit{\boldsymbol{P}}\left( {\mathit{\boldsymbol{Bw}} + \mathit{\boldsymbol{l}}} \right)\\ \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\mathop {{\rm{min}}}\limits_\mathit{\boldsymbol{x}} {\mathit{\boldsymbol{V}}^{\rm{T}}}\mathit{\boldsymbol{PV}} = \\ \;\;\;\mathit{\boldsymbol{w}} - {\mathit{\boldsymbol{H}}_0}{\left( {{\mathit{\boldsymbol{H}}_0}^{\rm{T}}{\mathit{\boldsymbol{B}}^{\rm{T}}}\mathit{\boldsymbol{PB}}{\mathit{\boldsymbol{H}}_0}} \right)^{ - 1}}{\mathit{\boldsymbol{H}}_0}^{\rm{T}}{\mathit{\boldsymbol{B}}^{\rm{T}}}\mathit{\boldsymbol{P}}\left( {\mathit{\boldsymbol{Bw}} + \mathit{\boldsymbol{l}}} \right)\\ \mathit{\boldsymbol{x}}\left| {{\rm{min}}{\mathit{\boldsymbol{V}}^{\rm{T}}}\mathit{\boldsymbol{PV}}}) \right. = {\mathit{\boldsymbol{H}}_r}\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}_r^{ - 1}\mathit{\boldsymbol{U}}_r^{\rm{T}}\mathit{\boldsymbol{t}} - {\mathit{\boldsymbol{H}}_0}{\left( {{\mathit{\boldsymbol{H}}_0}^{\rm{T}}{\mathit{\boldsymbol{B}}^{\rm{T}}}\mathit{\boldsymbol{PB}}{\mathit{\boldsymbol{H}}_0}} \right)^{ - 1}} \cdot \\ \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{\mathit{\boldsymbol{H}}_0}^{\rm{T}}{\mathit{\boldsymbol{B}}^{\rm{T}}}\mathit{\boldsymbol{P}}\left( {\mathit{\boldsymbol{B}}{\mathit{\boldsymbol{H}}_r}\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}_r^{ - 1}\mathit{\boldsymbol{U}}_r^{\rm{T}}\mathit{\boldsymbol{t}} + \mathit{\boldsymbol{l}}} \right) \end{array}$ (5)
${p_s} = {\left( {\frac{S}{{\rho ''{\sigma _s}}}} \right)^2}$ (6)
$\begin{array}{l} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{S_{{{mn}}}} = \\ \sqrt {{{\left( {{X_m} - {X_n}} \right)}^2} + {{\left( {{Y_m} - {Y_n}} \right)}^2} + {{\left( {{Z_m} - {Z_n}} \right)}^2}} \end{array}$
$\begin{array}{l} {S_{{{mn}}}} = \frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}{x_n} - \frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}{x_m} + \frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}{y_n} - \\ \;\;\;\;\;\;\frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}{y_m} + \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}{z_n} - \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}{z_m} + S_{mn}^0 \end{array}$
$\begin{array}{l} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;{\mathit{\boldsymbol{D}}_{SS}}{\rm{ = }}\\ \left( {\frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}, - \frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}, - \frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}, - \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}} \right) \cdot \\ {\mathit{\boldsymbol{D}}_{XX}}{\left( {\frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta X_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta Y_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}, \frac{{\Delta Z_{mn}^0}}{{S_{mn}^0}}} \right)^{\rm{T}}} \end{array}$ (7)
${\mathit{\boldsymbol{D}}_{XX}} = {\hat \sigma _0}^2{\mathit{\boldsymbol{Q}}_{xx}}$
2 算例
图 3 点位概略坐标示意图 Fig. 3 A schematic diagram of the outline coordinate
图 4 点位坐标精度统计 Fig. 4 Statistics of coordinate accuracy
图 5 空间距离精度统计 Fig. 5 Statistics for spatial distance accuracy
3 结语
1) 用全站仪交会测量后整体平差的方法可以用于地面激光扫描仪空间距离标准装置的校准,内符合精度优于0.1 mm,精度和激光跟踪仪相当。由于交会测量属于非接触测量,对于空间范围很大的空间距离标准装置校准来说,比激光跟踪仪更加安全、更方便操作。若使用激光跟踪仪测量,要充分考虑测量点的稳定性和分布。
2) 和工业经纬仪测量系统相比,全站仪使用广泛、价格便宜,使得建立工业测量系统更加便捷。用全站仪测量大尺度的空间标准距离,可以利用全站仪的免棱镜、后方交会等功能来直接测量概略坐标,更加直观、便捷,还可避免坐标推算造成的系统误差积累。
3) 交会测量后用整体平差法可以更好地利用全站仪的技术特点,直接使用补偿后的天顶方向为坐标纵轴,直接互瞄后(不需要内外觇标)得到水平角观测值,方法更加简便,精度一致性、可靠性都能满足工业测量的要求,可以用于更多室内精密测量的场景。
[1] 全国几何量长度委员会.JJF 1406-2013地面激光扫描仪校准规范[S].北京: 国家质量监督检疫总局, 2013 (National Geometric Length Committee.JJF 1406-2013 Calibration Specification for Terrestrial Laser Scanners[S].Beijing: General Administration of Quality Supervision, Inspection and Quarantine of the PRC, 2013) (0) [2] 杨占立, 范百兴, 西勤, 等. TLS算法在参考球标定场中的应用[J]. 测绘工程, 2016, 25(9): 40-43 (Yang Zhanli, Fan Baixing, Xi Qin, et al. Application of TLS to the Reference Ball Calibration Field[J]. Engineering of Surveying and Mapping, 2016, 25(9): 40-43) (0) [3] Boehler W, Marbs A. Investigating Laser Scanner Accuracy[C]. Sixth CIPA Symposium, 2003 (0) [4] 邓向瑞, 钱征宇, 周志春. 地面三维激光扫描仪距离校准装置及测量不确定度评定[J]. 计量学报, 2010, 31(增2): 157-159 (Deng Xiangrui, Qian Zhengyu, Zhou Zhichun. Terrestrial Laser Scanner Ranging Calibration Equipment and Evaluation of Measurement Uncertainty[J]. Acta Metrologica Sinica, 2010, 31(S2): 157-159) (0) [5] 李金鑫.基于室内规范检定场的地面三维激光扫描仪检校技术研究[D].青岛: 山东科技大学, 2017 (Li Jinxin.The Research of Terrestrial Laser Scanner Calibration Technology Based on Indoor Standard Field[D]. Qingdao: Shandong University of Science and Technology, 2017) http://cdmd.cnki.com.cn/Article/CDMD-10424-1017295190.htm (0) [6] 徐寿志, 程鹏飞, 张玉, 等. 地面三维激光扫描仪的检校与测量精度评定[J]. 测绘通报, 2016(2): 79-83 (Xu Shouzhi, Cheng Pengfei, Zhang Yu, et al. Calibration and Accuracy Evaluation of Terrestrial Laser Scanner[J]. Bulletin of Surveying and Mapping, 2016(2): 79-83) (0) [7] 梁建军, 范百兴, 邓向瑞, 等. 三维激光扫描仪球形靶标测量方法与精度评定[J]. 工程勘察, 2011, 39(2): 81-84 (Liang Jianjun, Fan Baixing, Deng Xiangrui, et al. Measurement Method and Precision Evaluation of Spherical Targets in 3D Laser Scanner[J]. Geotechnical Investigation and Surveying, 2011, 39(2): 81-84) (0) [8] 欧阳健飞, 刘万里, 闫勇刚, 等. 激光跟踪仪坐标测量精度的研究[J]. 红外与激光工程, 2008(增1): 15-18 (Ouyang Jianfei, Liu Wanli, Yan Yonggang, et al. Coordinate Measuring Accuracy of Laser Tracker[J]. Infrared and Laser Engineering, 2008(S1): 15-18) (0) [9] 孙海丽, 姚连璧, 周跃寅, 等. 激光跟踪仪测量精度分析[J]. 大地测量与地球动力学, 2015, 35(1): 177-181 (Sun Haili, Yao Lianbi, Zhou Yueyin, et al. Analysis of Measurement Accuracy of Laser Tracker[J]. Journal of Geodesy and Geodynamics, 2015, 35(1): 177-181) (0) [10] 王东伟, 姜黎, 陈晓晖, 等. 电子经纬仪测量系统交会测量误差分析[J]. 宇航计测技术, 2014(6): 4-8 (Wang Dongwei, Jiang Li, Chen Xiaohui, et al. Analysis of Electronic Theodolite Measurement System on Intersection Measurement Error[J]. Journal of Astronautic Metrology and Measurement, 2014(6): 4-8) (0) [11] 李广云, 李宗春. 工业测量系统原理与应用[M]. 北京: 测绘出版社, 2011 (Li Guangyun, Li Zongchun. The Principles and Applications of Industrial Measuring Systems[M]. Beijing: Surveying and Mapping Press, 2011) (0)
A Measuring Method for Space Distance Calibration Field Based on Total Station Intersection Survey
PENG Youzhi1 ZHANG Xin2 HE Haopeng1
1. Key Laboratory of Earthquake Geodesy, Institute of Seismology, CEA, 40 Hongshance Road, Wuhan 430071, China;
2. Wuhan Seismic Metrological Verification and Surveying Engineering Institute Co Ltd, 40 Hongshance Road, Wuhan 430071, China
Abstract: Space distance standard device is an important metrological standard for the calibrating terrestrial laser scanner. The measurement of the space distance of the target ball has always been a difficult problem. At present, most are measured by laser tracker. In this paper, we propose the coordinate measurement of target sphere by total station intersection survey. Firstly, the outline coordinates of feature points can be obtained quickly and conveniently by rear rendezvous and non-prism measurement. Then, the orientation datum can be established by mutual aiming. Finally, the high-precision coordinates of feature points can be obtained by overall adjustment. The example proves that the accuracy of this system is better than 0.1 mm, and it can meet the calibration accuracy requirement of space distance standard device.
Key words: laser scanner; calibration device; total station; intersection measurement; overall adjustment
|
Posted on Categories:Riemann surface, 数学代写, 黎曼曲面
# 数学代写|黎曼曲面代写Riemann surface代考|The Wolff lemma
avatest™
## avatest™帮您通过考试
avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试,包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您,创造模拟试题,提供所有的问题例子,以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试,我们都能帮助您!
•最快12小时交付
•200+ 英语母语导师
•70分以下全额退款
## 数学代写|黎曼曲面代写Riemann surface代考|The Wolff lemma
We now discuss the Wolff lemma, the second boundary version of the Schwarz lemma; in the next section, we shall see some of its consequences, mainly on the structure of the automorphism group of hyperbolic Riemann surfaces, even though for us the main applications will be in the study of the dynamics of holomorphic self-maps, as we shall see in the next chapter.
The original Schwarz lemma said something about functions $f \in \operatorname{Hol}(\mathbb{D}, \mathbb{D})$ with a fixed point in $\mathbb{D}$. We now assume instead as hypothesis that $f$ has no fixed points in $\mathbb{D}$. It turns out that then it exists a point $\tau \in \partial \mathbb{D}$ such that $f$ sends every horocycle centered in $\tau$ into itself, exactly as a function with a fixed point $z_0 \in \mathbb{D}$ sends every Poincaré ball centered in $z_0$ into itself. This is the content of the Wolff lemma.
Theorem 2.5.1 (Wolff lemma, 1926). Let $f \in \operatorname{Hol}(\mathbb{D}, \mathbb{D})$ be without fixed points. Then there is a unique $\tau \in \partial \mathbb{D}$ such that for all $z \in \mathbb{D}$,
$$\frac{|\tau-f(z)|^2}{1-|f(z)|^2} \leq \frac{|\tau-z|^2}{1-|z|^2},$$
i.e.,
$$f(E(\tau, R)) \subseteq E(\tau, R)$$
for all $R>0$. Moreover, the equality in (2.65) holds at one point (and hence everywhere) if and only if $f$ is a parabolic automorphism of $\mathbb{D}$ leaving $\tau$ fixed.
## 数学代写|黎曼曲面代写Riemann surface代考|The automorphism group of hyperbolic Riemann surfaces
The main applications of the Wolff lemma are in dynamics, as we shall see in the next chapter. Here, we shall instead describe a different application of the Wolff and Julia lemmas, with remarkable consequences for the study of Riemann surfaces.
In Proposition 1.4.12, we saw that two automorphisms of $\mathbb{D}$ commute if and only if they have the same fixed points. We shall now prove a first extension of that result.
Theorem 2.6.1. Let $y \in \operatorname{Aut}(\mathbb{D})$ be hyperbolic, and $f \in \operatorname{Hol}(\mathbb{D}, \mathbb{D})$ be such that
$$f \circ \gamma=y \circ f$$
Then either $f$ is a hyperbolic automorphism of $\mathbb{D}$ with the same fixed points as $y$ or $f \equiv \mathrm{id}_{\mathbb{D}}$.
Proof. Assume $f \neq \mathrm{id}_{\mathbb{D}}$; in particular, $f$ cannot have more than one fixed point (Corollary 1.1.14). If $f$ has a fixed point $z_0 \in \mathbb{D}$, then by (2.70)
$$f\left(\gamma\left(z_0\right)\right)=y\left(f\left(z_0\right)\right)=\gamma\left(z_0\right)$$
i. e., $\gamma\left(z_0\right)=z_0$, impossible. Hence $f$ is fixed point free and we can apply the Wolff lemma to get a point $\tau \in \partial \mathbb{D}$ satisfying (2.66). However, $\gamma(\tau)$ still satisfies (2.66), by (2.70) and Proposition 2.1.5; therefore, the uniqueness part of Wolff lemma implies $\gamma(\tau)=\tau$.
## 数学代写|黎曼曲面代写Riemann surface代考|The Wolff lemma
$$\frac{|\tau-f(z)|^2}{1-|f(z)|^2} \leq \frac{|\tau-z|^2}{1-|z|^2},$$
$$f(E(\tau, R)) \subseteq E(\tau, R)$$
## 数学代写|黎曼曲面代写Riemann surface代考|The automorphism group of hyperbolic Riemann surfaces
$$f \circ \gamma=y \circ f$$
$$f\left(\gamma\left(z_0\right)\right)=y\left(f\left(z_0\right)\right)=\gamma\left(z_0\right)$$
## MATLAB代写
MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中,其中问题和解决方案以熟悉的数学符号表示。典型用途包括:数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发,包括图形用户界面构建MATLAB 是一个交互式系统,其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题,尤其是那些具有矩阵和向量公式的问题,而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问,这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展,得到了许多用户的投入。在大学环境中,它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域,MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要,工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数(M 文件)的综合集合,可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。
|
# Quod Erat Demonstrandum
## 2010/07/26
### MVT 某推廣
Filed under: HKALE,Pure Mathematics — johnmayhk @ 11:54 上午
Tags: ,
$F(x) = -3x + \frac{\pi}{2}\cos(\frac{\pi}{2}x) + \frac{e^x}{e - 1} + \frac{1}{(x + 2)\ln 2}$ 在區間 (0,1) 存在零點 ………. (*)
$F(0) , F(1)$ 皆大於零,故不宜用介值定理(Intermediate Value Theorem)。
$F(1) \approx$ -0.696675773,即可用介值定理一步 KO 的。
$\alpha_1, \alpha_2, \dots , \alpha_n$ 為 n 個實數,且有 $\alpha_1 + \alpha_2 + \dots + \alpha_n = 0$
$f_1(x), f_2(x), \dots , f_n(x)$ 為 n 個在 [a , b] 上連續並在 (a , b) 上可導之函數,
$\displaystyle\sum_{i = 1}^n \frac{\alpha_i f_i'(c)}{f_i(b) - f_i(a)} = 0$
$n = 4$
$a = 0$
$b = 1$
$f_1(x) = x^2$
$f_2(x) = \sin(\frac{\pi}{2}x)$
$f_3(x) = e^x$
$f_4(x) = \ln(x + 1)$
$\alpha_1 = -3, \alpha_2 = \alpha_3 = \alpha_4 = 1$
$g(x)$
$= \alpha_1(f_2(b) - f_2(a))(f_3(b) - f_3(a))(f_1(x) - f_1(a))$
$+ \alpha_2(f_1(b) - f_1(a))(f_3(b) - f_3(a))(f_2(x) - f_2(a))$
$+ \alpha_3(f_1(b) - f_1(a))(f_2(b) - f_2(a))(f_3(x) - f_3(a))$
$g(a) = 0$
$g(b) = (f_1(b) - f_1(a))(f_2(b) - f_2(a))(f_3(b) - f_3(a))(\alpha_1 + \alpha_2 + \alpha_3) = 0$
result follows.
|
End of preview.