ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1074. Very Short Problem

WA #7. I have many tests, but do not have the right
Posted by Ionkin M [Samara SAU #617] 29 Mar 2017 22:35
I have WA 7 and I don't understand what the problem is.
My tests:
// check(<input string #1>, <input string #2> as integer, <output string>)

// tests from acm.timus
check("10.23", 0, "10")
check(".04", 1, "0.0")
check("-0.051e0", 1, "0.0")
check("1.1e30", 10, "1100000000000000000000000000000.0000000000")
check("-1.1e-30", 1, "0.0")
check("2468097632.1358642324268913e-2", 20, "24680976.32135864232426891300")
check("e23", 3, "Not a floating point number")
check("1 e3", 1, "Not a floating point number")

// my tests
check(" 1 e3", 1, "Not a floating point number")
check("1e3", 1, "1000.0")
// Posted by Igor Dex 1 Jun 2011 18:28
// It is clear that we can't have leading spaces in case correct real number. But is it possible to have spaces after correct number till the end of the string?
// Posted by AterLux 1 Jun 2011 23:05
// No. Trailing as leading spaces not satisfy the syntactical description.
check("   ", 1, "Not a floating point number")
check(" ", 1, "Not a floating point number")
check("-", 1, "Not a floating point number")
check(" 1e3", 1, "Not a floating point number")
check(" .1e3", 1, "Not a floating point number")
check(".1e-3", 1, "0.0")
check(" .1e-3 ", 1, "Not a floating point number")
check(".1e-3 ", 1, "Not a floating point number")
check(".0e-10000000000000000000", 1, "0.0")
check(".0e+10000000000000000000", 1, "0.0")

// int and uint tests
check("10", 0, "10")
check("10", 1, "10.0")
check("-10", 1, "-10.0")
check("+10", 1, "10.0")
// simplefloat and usimplefloat tests
check(".10", 1, "0.1")
check("10.10", 1, "10.1")
check("10.01", 1, "10.0")
check("+.10", 1, "0.1")
check("+10.10", 1, "10.1")
check("+10.01", 1, "10.0")
check("-.10", 1, "-0.1")
check("-10.10", 1, "-10.1")
check("-10.01", 1, "-10.0")
// float tests
check("10e0", 0, "10")
check("10e-1", 1, "1.0")
check("-10e+1", 1, "-100.0")
check("+10e+3", 1, "10000.0")
check(".10e-3", 1, "0.0")
check("10.10e-1", 1, "1.0")
check("10.01e-2", 1, "0.1")
check("+.10e-10000", 1, "0.0")
check("+10.10e-100", 1, "0.0")
check("+10.01e1", 1, "100.1")
check("-.10e1", 1, "-1.0")
check("-10.10e-1", 1, "-1.0")
check("-10.01e-2", 1, "-0.1")
// "Not a floating point number" tests

// Posted by Kopeliovitch Sergey (1) 30 Jul 2004 21:29
// Segey say his progamm have AC with other answers, but right answers are
//Update: Now Segey have WA #1 and WA #12 and didn't have AC.
check("10.", 1, "Not a floating point number")
check("10.0e", 1, "Not a floating point number")
check("10.e", 1, "Not a floating point number")

//
check("1E1 1", 1, "Not a floating point number")
check("-+3", 1, "Not a floating point number")
check("+", 1, "Not a floating point number")
check("-", 1, "Not a floating point number")
check(" ", 1, "Not a floating point number")
check("-10.01ee", 1, "Not a floating point number")
check("12.e10", 1, "Not a floating point number")
check("-.e10", 1, "Not a floating point number")
check("1e", 1, "Not a floating point number")
check("e1", 1, "Not a floating point number")
check("e", 1, "Not a floating point number")
check("se-1", 1, "Not a floating point number")
check("+e", 1, "Not a floating point number")
check("-e1", 1, "Not a floating point number")
check(".e4", 1, "Not a floating point number")
check("0.", 1, "Not a floating point number")
check("1e", 1, "Not a floating point number")
check("0x123", 1, "Not a floating point number")
check("1E2.1", 1, "Not a floating point number")
check("-1E2.1", 1, "Not a floating point number")
check("1E2.1e2", 1, "Not a floating point number")
check("1e00-1", 0, "Not a floating point number")
// # tests
check("1#", 1, "Not a floating point number")
check("#1", 1, "Not a floating point number")
check("# 1", 1, "Not a floating point number")
check("1 #", 1, "Not a floating point number")
// big power test
check("1e10", 1, "10000000000.0")
check("1e10", 0, "10000000000")
check("-1e10", 0, "-10000000000")
check("1e-10", 0, "0")
check("0e+10", 0, "0")
check("0e+100", 0, "0")
check("0e+10000000000000000000", 0, "0")
check("0e-10000000000000000000", 0, "0")
check("0e10000000000000000000", 0, "0")
check("1e000000000000000000000000000000000000000000000000000000000000000000000000000000", 0, "1")
check("1e000000000000000000000000000000000000000000000000000000000000000000000000000001", 0, "10")
check("1e-000000000000000000000000000000000000000000000000000000000000000000000000000001", 0, "0")
check("234565432452433e-10000000000000000000", 0, "0")
check("-234565432452433e-10000000000000000000", 0, "0")

// An integral part of a number should be non-empty.
check(".1e+0", 1, "0.1")
check("-.1e+0", 1, "-0.1")
// There shouldn't be leading zeroes in a non-zero integral part of a number.
// A zero integral part of a number should consist of an only zero.
check("00000.1e+0", 1, "0.1")
check("-00000.1e+0", 1, "-0.1")
check("00001.1e+0", 1, "1.1")
check("-00001.1e+0", 1, "-1.1")
check("00001.1", 1, "1.1")
check("-00001.1", 1, "-1.1")
check("00001.1", 0, "1")
check("-00001.1", 0, "-1")
// A fractional part of a number should contain exactly N symbols.
check("00001.1", 0, "1")
check("00001.1", 3, "1.100")
check("-00001.1", 1, "-1.1")
// There shouldn't be a sign "+" before a positive number.
check("+00001.1", 0, "1")
check("+1.1", 0, "1")
check("+1.1", 3, "1.100")
check("+1.1e+1", 1, "11.0")
// You shouldn't round off a number.
check("+1.5e+1", 1, "15.0")
check("+1.06", 1, "1.0")
check("+1.6e-1", 1, "0.1")

Edited by author 29.03.2017 22:42

Edited by author 29.03.2017 22:47

Edited by author 30.03.2017 00:56
Re: WA #7. I have many tests, but do not have the right
Posted by ♫♫ Anastasiya 12 May 2017 23:25
Thank's for tests, it was very useful (saved a lot of my time, but didn't help).
I had WA7 too, but i found my bug (forgot about re-reverse in code).
Found mistake after test: check("12345.6789e1", 3, "123456.789");