/ Vijos / 题库 /

# 描述

<line> :: <head> | <assignment> | <if> | ELSE | END IF | <return>
<head> :: PARAM <paramlist> | PARAM
<assignment> :: <variable> = <rvalue>
<if> :: IF <variable> <relation> <value> THEN
<return> :: RETURN <value>
<paramlist> :: <variable> | <variable> <paramlist>
<rvalue> :: <value> | <value> <operator> <value>
<value> :: <variable> | <integer>
<operator> :: + | - | * | /
<relation> :: < | = | >
<variable> :: A | B | ... | Z
<integer> :: 不含前导0的32位带符号整数

? 第一类警告：无法到达的代码行。不管各条IF语句的布尔表达式是真还是假（假设每条IF语句的布尔表达式都是既可能为真也可能为假，不受其他IF语句结果影响）。
? 第二类警告：可能未初始化的变量。该语句用到了某个变量的值，但这个变量既不在第一行指定的参数列表里，也没有在此之前由赋值语句赋值过。如果这条语句无法到达，那么不应该给出这类警告。

# 样例1

## 样例输入1

``````PARAM A B
IF A &gt; 5 THEN
C = B * A
END IF
D = B - C
Z = Y + X
E = T
F = E + E
V = G + G
RETURN F
``````

## 样例输出1

``````Line 5: variable C might not have been initialized
Line 6: variable X might not have been initialized
Line 6: variable Y might not have been initialized
Line 7: variable T might not have been initialized
Line 9: variable G might not have been initialized
``````

# 提示

【样例2】

PARAM G
RETURN G
B = K
RETURN C

Line 3: unreachable code
Line 4: unreachable code
【样例3】

PARAM T C
B = T
A = 4
IF A < 4 THEN
IF B > 3 THEN
Q = 100 + F
ELSE
IF C = -1111111111 THEN
Q = T - A
IF Q = 0 THEN
V = V - 1
END IF
ELSE
RETURN I
E = A
END IF
END IF
ELSE
Q = 1
END IF
RETURN Q

Line 6: variable F might not have been initialized
Line 11: variable V might not have been initialized
Line 14: variable I might not have been initialized
Line 15: unreachable code

2008四川省选

ID
1387

7

46

9

20%

2

RP++分类题库