-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.toml
437 lines (386 loc) · 12.8 KB
/
info.toml
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
[[exercises]]
path = "solutiont1"
score = 5
test = """
// src/tests.rs
mod conjecture;
#[cfg(test)]
mod tests {
use super::conjecture::goldbach_conjecture;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
// 196702;
const TEST_CASE: u64 = 11770;
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_conjecture() {
let start = Instant::now();
let result = goldbach_conjecture();
let duration = start.elapsed();
// 时间超0.5s,判定不合格
let mut total_score = 0.0;
if duration <= Duration::from_millis(500) && result == TEST_CASE {
total_score += 100.0;
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont2"
score = 10
test = """mod district;
#[cfg(test)]
mod tests {
use super::district::count_provinces;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASE: &str = "3,3,2,2,1";
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_count_provinces() {
let start = Instant::now();
let result = count_provinces();
let duration = start.elapsed();
// 时间超1s,判定不合格
let mut total_score = 0.0;
if duration <= Duration::new(1, 0) && result == TEST_CASE {
total_score += 100.0;
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont3"
score = 10
test = """// src/tests.rs
mod calc_time;
#[cfg(test)]
mod tests {
use super::calc_time::time_info;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(&str, &str)] = &[
("2024-11-10", "45,51,79"),
("2024-11-18", "47,43,71"),
("2024-12-31", "1,0,28"),
("2025-01-01", "1,364,27"),
("2025-12-31", "1,0,47"),
("2020-01-20", "4,346,4"),
("2021-02-13", "6,321,352"),
("2012-01-22", "3,344,0"),
("2013-02-11", "7,323,353"),
("2014-02-02", "5,332,381"),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_calc_time() {
let mut total_score = 0.0;
for (input, expected) in TEST_CASES {
let start = Instant::now();
let result = time_info(*input);
let duration = start.elapsed();
// 时间超0.2s,判定不合格
if duration <= Duration::from_millis(200) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont4"
score = 10
test = """// src/tests.rs
mod wade_giles_romanization;
#[cfg(test)]
mod tests {
use super::wade_giles_romanization::converter;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(&str, &str)] = &[
("中国", "Chung kuo"),
("@", ""),
("诸葛亮", "Chu ko liang"),
("孙中山", "Sun chung shan"),
("台湾", "T'ai wan"),
("香港", "Hsiang kang"),
("澳門", "Ao men"),
("川普", "Ch'uan p'u"),
("四川", "Ssu ch'uan"),
("廣州", "Kuang chou"),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_wadegiles() {
let mut total_score = 0.0;
for (input, expected) in TEST_CASES {
let start = Instant::now();
let result = converter(*input);
let duration = start.elapsed();
// 时间超0.5s,判定不合格
if duration <= Duration::from_millis(500) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont5"
score = 10
test = """// src/tests.rs
mod retirement;
#[cfg(test)]
mod tests {
use super::retirement::retire_time;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(&str, &str, &str)] = &[
("1971-04", "原法定退休年龄55周岁女职工", "2026-08,55.33,4"),
("1995-12", "原法定退休年龄50周岁女职工", "2050-12,55,60"),
("1995-12", "男职工", "2058-12,63,36"),
("2000-12", "原法定退休年龄55周岁女职工", "2058-12,58,36"),
("2000-12", "男职工", "2063-12,63,36"),
("1965-12", "男职工", "2026-03,60.25,3"),
("1963-12", "男职工", "2023-12,60,0"),
("1963-04", "原法定退休年龄55周岁女职工", "2018-04,55,0"),
("1964-02", "男职工", "2024-02,60,0"),
("1965-01", "男职工", "2025-02,60.08,1"),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_retirement_time() {
let mut total_score = 0.0;
for (time, tp, expected) in TEST_CASES {
let start = Instant::now();
let result = retire_time(*time, *tp);
let duration = start.elapsed();
// 时间超0.2s,判定不合格
if duration <= Duration::from_millis(200) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont6"
score = 10
test = """// src/tests.rs
mod simple2traditional;
#[cfg(test)]
mod tests {
use super::simple2traditional::converter;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(&str, &str, &str)] = &[
("学习", "s2t", "學習"),
("老板", "s2t", "老闆"),
("四川", "s2t", "四川"),
("四川", "t2s", "四川"),
("头发", "s2t", "頭髮"),
("发财", "s2t", "發財"),
("皇后", "s2t", "皇后"),
("前后", "s2t", "前後"),
("搜刮", "s2t", "搜刮"),
("xx", "t2s", "xx"),
("", "t2s", ""),
("@", "t2s", "@"),
("0", "t2s", "0"),
("魏征", "s2t", "魏徵"),
("魏征", "t2s", "魏征"),
("面条", "s2t", "麵條"),
("小麥", "s2t", "小麥"),
("树干", "s2t", "樹幹"),
("干涉", "s2t", "干涉"),
("子丑寅卯", "s2t", "子丑寅卯"),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_s2t_or_t2s() {
let mut total_score = 0.0;
for (input, tp, expected) in TEST_CASES {
let start = Instant::now();
let result = converter(*input, *tp);
let duration = start.elapsed();
// 时间超0.5s,判定不合格
if duration <= Duration::from_millis(500) && result == *expected {
total_score += 5.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont7"
score = 10
test = """// src/tests.rs
mod identity_card;
#[cfg(test)]
mod tests {
use super::identity_card::check_id_card;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
// 申明:随机生成的测试身份证号,仅限测试使用,任何人不得盗用,违者按法律严惩!
const TEST_CASES: &[(&str, &str)] = &[
("420111198203251029", "身份证号码正确,女,1982年03月25日,湖北省-武汉市-洪山区"),
("11000019900101001X", "身份证号码错误"),
("370725881105149", "身份证号码正确,男,1988年11月05日,山东省-潍坊市-昌乐县"),
("37072519881105149X", "身份证号码正确,男,1988年11月05日,山东省-潍坊市-昌乐县"),
("@", "身份证号码错误"),
("1101021990010110140", "身份证号码错误"),
("110102199001011014", "身份证号码正确,男,1990年01月01日,北京市-市辖区-西城区"),
("510303199009142328", "身份证号码正确,女,1990年09月14日,四川省-自贡市-贡井区"),
("320106199002071259", "身份证号码正确,男,1990年02月07日,江苏省-南京市-鼓楼区"),
("310104199007122348", "身份证号码正确,女,1990年07月12日,上海市-市辖区-徐汇区"),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_id_card_check() {
let mut total_score = 0.0;
for (input, expected) in TEST_CASES {
let start = Instant::now();
let result = check_id_card(*input);
let duration = start.elapsed();
// 时间超0.5s,判定不合格
if duration <= Duration::from_millis(500) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont8"
score = 10
test = """// src/tests.rs
mod prime_factor;
#[cfg(test)]
mod tests {
use super::prime_factor::find_max_prime_factor;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(u128, u128)] = &[
(10000071, 370373),
(600851475143, 6857),
(1600851475143, 16807369),
(76008514751430, 2163013),
(96008514751430, 223275615701),
(99999999951437, 5218879),
(1199999999951437, 3945019577),
(9999999999999951437,387792298444951),
(97993999919999958437, 203729729563409477),
(199999999999999951437, 9523809523809521497),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_max_prime_factor() {
let mut total_score = 0.0;
for (input, expected) in TEST_CASES {
let start = Instant::now();
let result = find_max_prime_factor(*input);
let duration = start.elapsed();
// 时间超3s,判定不合格
if duration <= Duration::new(3, 0) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont9"
score = 10
test = """// src/tests.rs
mod spiral_prime;
#[cfg(test)]
mod tests {
use super::spiral_prime::min_edge_prime_num;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(u32, &str)] = &[
(60, "5,5"),
(55, "9,9"),
(50, "11,10"),
(40, "31,23"),
(30, "49,28"),
(20, "309,123"),
(10, "26241,5248"),
(9, "74373,13387"),
(8, "238733,38197"),
(7, "1213001,169820"),
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_prime_percent() {
let mut total_score = 0.0;
for (input, expected) in TEST_CASES {
let start = Instant::now();
let result = min_edge_prime_num(*input);
let duration = start.elapsed();
// 时间超6s,判定不合格
if duration <= Duration::new(6, 0) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""
[[exercises]]
path = "solutiont10"
score = 15
test = """// src/tests.rs
mod zuc_encryption;
#[cfg(test)]
mod tests {
use super::zuc_encryption::encryption;
use std::time::{Instant, Duration};
// 定义测试用例和预期结果
const TEST_CASES: &[(&str, &str)] = &[
("特朗普", "/QZb7S0JWp/IYuwB"),
("吉普车", "/x9r7SgwVLvAYuwB"),
("中国人", "/jdP7iojWLzcYuwB"),
("RustRover", "SPqRf+PxymMUYuwB"),
("@####", "WqzBKJKdvwU="),
("0", "KozhCA=="),
("深心托豪素,怀抱观古今", "/DhT7g4dWo/+iV6oScyAPMtykWeYW34bCcaYzZudbAU="),
("境外势力", "/y1h7hUIWYzZhGWZqnwkFA=="),
("信息化数字化智能化", "/jBD7TAxWYrwh3qyS9W39aFk9xioAhUBbq+BaA=="),
("Talk is cheap, show me the code", "Tu6OYJH3zyYFCYpj3lQAY0WdZqF/j7bI40Y3ChBCgwU=")
];
// 定义一个测试函数来验证每个测试用例
#[test]
fn test_zuc_encryption() {
let mut total_score = 0.0;
for (input, expected) in TEST_CASES {
let start = Instant::now();
let result = encryption((*input).to_string());
let duration = start.elapsed();
// 时间超0.2s,判定不合格
if duration <= Duration::from_millis(200) && result == *expected {
total_score += 10.0;
}
}
println!("Total score: {:.2}", total_score);
assert_eq!(100.00, total_score);
}
}
"""