A very difficult question seems to be violent .. It was easy to use _ int64, wa, and then found that it was not that simple.
1. Unified Positive and Negative Numbers
2. Remove pilot zero
3. Remove the 0 at the end of the decimal point.
3. All kinds of pits indicated by 0 + 0-0 + 0.00-0.000 are yes...
Do not look down on questions .. ORZ
[Cpp]
# Include <iostream>
# Include <string>
# Include <cstdio>
# Include <ctype. h>
Using namespace std;
Int main ()
{
String a, B;
String blank = "";
While (cin> a> B)
{
Bool a0 = 1, b0 = 1;
// 0, preventing 0.00-0 + 0.000 + 00. 000 ......
For (int I = 0; I <a. length (); I ++)
{
If (a [I]! = '0' & a [I]! = '.' & A [I]! = '+' & A [I]! = '-')
{
A0 = 0;
Break;
}
}
For (int I = 0; I <B. length (); I ++)
{
If (B [I]! = '0' & B [I]! = '.' & B [I]! = '+' & B [I]! = '-')
{
B0 = 0;
Break;
}
}
If (a0 = 1 & b0 = 1)
{
Cout <"YES" <endl;
Break;
}
// 1-prevent + 0
If (isdigit (a [0])
A. insert (0, "+ ");
If (isdigit (B [0])
B. insert (0, "+ ");
Int posa = a. length ()-1;
Int posb = B. length ()-1;
Int befzeroa = 0, befzerob = 0;
For (int j = 1; j <posa; j ++)
{
If (a [j] = '0 ')
Continue;
Else
{
Befzeroa = J-1;
Break;
}
}
For (int j = 1; j <posb; j ++)
{
If (B [j] = '0 ')
Continue;
Else
{
Befzerob = J-1;
Break;
}
}
// 2-prevent 009.7 9.7
A. erase (1, befzeroa); // correct deletion usage
B. erase (1, befzerob );
Int lastzeroa = a. length ();
Int lastzerob = B. length ();
For (int I = 1; I <a. length (); I ++)
{
If (a [I] = '.')
Posa = I;
}
For (int j = 1; j <B. length (); j ++)
{
If (B [j] = '.')
Posb = j;
}
For (int p = a. length ()-1; p> posa; p --)
{
If (a [p] = '0 ')
{
A. erase (p, 1 );
}
Else
{
Break;
}
}
For (int t = B. length ()-1; t> posb; t --)
{
If (B [t] = '0 ')
{
B. erase (t, 1 );
}
Else
{
Break;
}
}
// 3-prevent 3.0 --- 3
If (a [a. length ()-1] = '.')
A. erase (a. length ()-1, 1 );
If (B [B. length ()-1] = '.')
B. erase (B. length ()-1, 1 );
// Cout <a <"" <B <endl;
If (a = B)
Cout <"YES" <endl;
Else
Cout <"NO" <endl;
}
Return 0;
}
# Include <iostream>
# Include <string>
# Include <cstdio>
# Include <ctype. h>
Using namespace std;
Int main ()
{
String a, B;
String blank = "";
While (cin> a> B)
{
Bool a0 = 1, b0 = 1;
// 0, preventing 0.00-0 + 0.000 + 00. 000 ......
For (int I = 0; I <a. length (); I ++)
{
If (a [I]! = '0' & a [I]! = '.' & A [I]! = '+' & A [I]! = '-')
{
A0 = 0;
Break;
}
}
For (int I = 0; I <B. length (); I ++)
{
If (B [I]! = '0' & B [I]! = '.' & B [I]! = '+' & B [I]! = '-')
{
B0 = 0;
Break;
}
}
If (a0 = 1 & b0 = 1)
{
Cout <"YES" <endl;
Break;
}
// 1-prevent + 0
If (isdigit (a [0])
A. insert (0, "+ ");
If (isdigit (B [0])
B. insert (0, "+ ");
Int posa = a. length ()-1;
Int posb = B. length ()-1;
Int befzeroa = 0, befzerob = 0;
For (int j = 1; j <posa; j ++)
{
If (a [j] = '0 ')
Continue;
Else
{
Befzeroa = J-1;
Break;
}
}
For (int j = 1; j <posb; j ++)
{
If (B [j] = '0 ')
Continue;
Else
{
Befzerob = J-1;
Break;
}
}
// 2-prevent 009.7 9.7
A. erase (1, befzeroa); // correct deletion usage
B. erase (1, befzerob );
Int lastzeroa = a. length ();
Int lastzerob = B. length ();
For (int I = 1; I <a. length (); I ++)
{
If (a [I] = '.')
Posa = I;
}
For (int j = 1; j <B. length (); j ++)
{
If (B [j] = '.')
Posb = j;
}
For (int p = a. length ()-1; p> posa; p --)
{
If (a [p] = '0 ')
{
A. erase (p, 1 );
}
Else
{
Break;
}
}
For (int t = B. length ()-1; t> posb; t --)
{
If (B [t] = '0 ')
{
B. erase (t, 1 );
}
Else
{
Break;
}
}
// 3-prevent 3.0 --- 3
If (a [a. length ()-1] = '.')
A. erase (a. length ()-1, 1 );
If (B [B. length ()-1] = '.')
B. erase (B. length ()-1, 1 );
// Cout <a <"" <B <endl;
If (a = B)
Cout <"YES" <endl;
Else
Cout <"NO" <endl;
}
Return 0;
}