@@ -342,28 +342,26 @@ class StorageUtils {
342
342
let temp_collect = "" ;
343
343
for ( let all_input = 0 ; all_input < input . length ; all_input ++ ) {
344
344
const element = input [ all_input ] ;
345
- let check_index = element . indexOf ( "输入:" ) ;
346
-
347
- if ( check_index == - 1 ) {
348
- check_index = element . indexOf ( "输入:" ) ;
349
- }
345
+ let check_input_1 = element . indexOf ( "输入:" ) ;
346
+ let check_input_2 = element . indexOf ( "输入:" ) ;
347
+ let check_input_3 = element . indexOf ( "Input:" ) ;
348
+ if ( check_input_1 != - 1 || check_input_2 != - 1 || check_input_3 != - 1 ) {
349
+ if ( check_input_1 != - 1 ) {
350
+ temp_collect += element . substring ( check_input_1 + 3 ) ;
351
+ } else if ( check_input_2 != - 1 ) {
352
+ temp_collect += element . substring ( check_input_2 + 3 ) ;
353
+ } else if ( check_input_3 != - 1 ) {
354
+ temp_collect += element . substring ( check_input_3 + 6 ) ;
355
+ }
350
356
351
- if ( check_index == - 1 ) {
352
- check_index = element . indexOf ( "Input:" ) ;
353
- }
354
- if ( check_index != - 1 ) {
355
- temp_collect += element . substring ( check_index + 1 ) ;
356
357
start_flag = true ;
357
358
continue ;
358
359
}
359
- check_index = element . indexOf ( "输出:" ) ;
360
- if ( check_index == - 1 ) {
361
- check_index = element . indexOf ( "输出:" ) ;
362
- }
363
- if ( check_index == - 1 ) {
364
- check_index = element . indexOf ( "Output:" ) ;
365
- }
366
- if ( check_index != - 1 ) {
360
+
361
+ let check_index_1 = element . indexOf ( "输出:" ) ;
362
+ let check_index_2 = element . indexOf ( "输出:" ) ;
363
+ let check_index_3 = element . indexOf ( "Output:" ) ;
364
+ if ( check_index_1 != - 1 || check_index_2 != - 1 || check_index_3 != - 1 ) {
367
365
start_flag = false ;
368
366
}
369
367
if ( start_flag ) {
@@ -374,21 +372,29 @@ class StorageUtils {
374
372
let temp_case : Array < any > = [ ] ;
375
373
let wait_cur = "" ;
376
374
let no_need_flag = false ;
377
- for ( let index = new_ele . length - 1 ; index >= 0 ; index -- ) {
378
- if ( no_need_flag ) {
379
- if ( new_ele [ index ] == "," ) {
380
- no_need_flag = false ;
381
- }
382
- } else {
383
- if ( new_ele [ index ] == "=" ) {
384
- temp_case . push ( wait_cur . trim ( ) ) ;
385
- no_need_flag = true ;
386
- wait_cur = "" ;
375
+
376
+ // 1040题的输入不标准 没有 x = aaa
377
+ if ( temp_collect . indexOf ( "=" ) == - 1 ) {
378
+ temp_case . push ( temp_collect . trim ( ) ) ;
379
+ } else {
380
+ // 解析 x = aaa, y = bbb 之类的输入参数
381
+ for ( let index = new_ele . length - 1 ; index >= 0 ; index -- ) {
382
+ if ( no_need_flag ) {
383
+ if ( new_ele [ index ] == "," ) {
384
+ no_need_flag = false ;
385
+ }
387
386
} else {
388
- wait_cur = new_ele [ index ] + wait_cur ;
387
+ if ( new_ele [ index ] == "=" ) {
388
+ temp_case . push ( wait_cur . trim ( ) ) ;
389
+ no_need_flag = true ;
390
+ wait_cur = "" ;
391
+ } else {
392
+ wait_cur = new_ele [ index ] + wait_cur ;
393
+ }
389
394
}
390
395
}
391
396
}
397
+
392
398
let new_temp_case : Array < any > = [ ] ;
393
399
for ( let tci = temp_case . length - 1 ; tci >= 0 ; tci -- ) {
394
400
new_temp_case . push ( temp_case [ tci ] ) ;
0 commit comments