Tantangan ini adalah untuk mengangkat semangat mod kami Alex A. , yang biasanya salah .
Misalkan Anda memiliki teman bernama Alex yang membutuhkan bantuan dengan logika dan matematika dasar, khususnya kesetaraan matematika .
Dia memberi Anda daftar persamaan bentuk di [variable] = [variable]mana a[variable] selalu huruf besar tunggal A sampai Z (bukan huruf kecil, bukan angka, atau apa pun). Ada satu persamaan per baris dalam daftar kecuali untuk satu baris yang hanya mengatakan therefore.
Semua persamaan di atas thereforeadalah premis , fakta yang dianggap benar. Semua persamaan di bawah ini thereforeadalah proposisi yang tidak diverifikasi, fakta yang berusaha disimpulkan Alex dari premis-premisnya, dan itu mungkin benar atau tidak benar.
Misalnya, dalam daftar persamaan ini proposisi kesimpulan tunggal A = Cternyata benar:
A = B
B = C
therefore
A = C
Adalah tugas Anda untuk memberi tahu Alex apakah semua proposisinya secara logis mengikuti dari tempat yang diberikan. Artinya, Anda perlu memberi tahu Alex apakah dia salah atau benar dalam kesimpulannya.
Tulis program / fungsi yang mengambil string dari daftar persamaan seperti yang dijelaskan dan dicetak / dikembalikan
Alex is right
jika semua kesimpulan mengikuti secara logis dari tempat, dan jika tidak, output
Alex is wrong
jika ada kesimpulan tidak secara logis mengikuti dari tempat.
Kode terpendek dalam byte menang.
Pastikan untuk mewaspadai kasus-kasus ini:
Variabel selalu sama dengan diri mereka sendiri. misalnya
B = A therefore A = A X = Xhasil dalam
Alex is right.Variabel dengan hubungan yang tidak diketahui tidak dapat dianggap sama. misalnya
P = Q therefore E = Rhasil dalam
Alex is wrong.Ketika tidak ada persamaan setelah itu
thereforemaka kesimpulannya benar . misalnyaD = C thereforedan
thereforekeduanya menghasilkan
Alex is right.Ketika tidak ada persamaan sebelum
thereforemaka hanya kesetaraan diri dapat disimpulkan. misalnyatherefore R = Rmenghasilkan
Alex is right, tetapitherefore R = Whasil dalam
Alex is wrong.
Lebih banyak contoh
Kasus Alex salah: (dipisahkan oleh garis kosong)
A = B
C = D
therefore
A = C
A = L
E = X
A = I
S = W
R = O
N = G
therefore
G = N
L = I
R = O
S = A
X = X
X = E
D = K
D = Q
L = P
O = L
M = O
therefore
K = L
A = B
therefore
B = C
Z = A
S = S
therefore
A = Z
A = A
S = A
A = S
Z = A
Z = A
K = L
K = X
therefore
X = P
L = X
L = P
therefore
A = B
B = C
A = C
therefore
A = A
B = B
C = C
D = D
E = E
F = F
G = G
H = H
I = I
J = J
K = K
T = I
L = L
M = M
N = N
O = O
P = P
Q = Q
R = R
S = S
T = T
U = U
V = V
W = W
X = X
Y = Y
Z = Z
A = B
B = C
C = D
D = E
E = F
F = G
G = H
H = I
I = J
J = K
K = L
L = M
M = N
N = O
O = P
P = O
Q = R
R = S
S = T
T = U
U = V
V = W
W = X
X = Y
Y = Z
therefore
A = Z
therefore
C = D
T = Y
A = Z
P = Q
therefore
E = R
therefore
R = W
Alex adalah kasus yang benar:
H = J
therefore
J = H
K = L
K = X
therefore
L = X
C = B
B = A
therefore
A = B
K = L
K = X
K = P
therefore
L = X
L = P
X = P
A = Y
Y = Q
Q = O
therefore
O = Y
O = A
C = C
therefore
C = C
A = B
B = A
therefore
A = B
B = A
A = B
B = C
C = D
therefore
A = A
A = B
A = C
A = D
B = A
B = B
B = C
B = D
C = A
C = B
C = C
C = D
D = A
D = B
D = C
D = D
therefore
A = A
B = B
C = C
D = D
E = E
F = F
G = G
H = H
I = I
J = J
K = K
L = L
M = M
N = N
O = O
P = P
Q = Q
R = R
S = S
T = T
U = U
V = V
W = W
X = X
Y = Y
Z = Z
D = I
F = H
J = M
therefore
M = J
D = I
H = F
A = B
B = C
C = D
D = E
E = F
F = G
G = H
H = I
I = J
J = K
K = L
L = M
M = N
N = O
O = P
P = Q
Q = R
R = S
S = T
T = U
U = V
V = W
W = X
X = Y
Y = Z
therefore
Z = A
F = R
G = I
W = L
A = B
B = C
therefore
A = C
B = A
therefore
A = A
X = X
P = P
C = G
M = C
therefore
D = C
therefore
therefore
therefore
R = R
therefore\nTABS < SPACES->Alex is right
Alex is wrongMemverifikasi semua kasus uji.