|
|
back to boardThe coordinates are a pair of integers .... It's right ? Posted by ryu 10 Jan 2009 23:18 I got AC after used double (instead long long). Then I wrote code: scanf("%d", &N); for (int i = 0; i < N; ++i) { P[i].x = ReadAndCheck(); P[i].y = ReadAndCheck(); } double ReadAndCheck() { char s[100]; scanf("%s", s); for (int i = 0; s[i]; ++i) Assert(isdigit(s[i])); double r; sscanf(s, "%lf", &r); return r; } To all appearences Assert was called (4 test). Did you think about negative numbers? Re: The coordinates are a pair of integers .... It's right ? I've got AC reading ints. Please change Assert(isdigit(s[i])); to Assert(isdigit(s[i]) || s[i] == '-'); and test if Assert will be called. Re: The coordinates are a pair of integers .... It's right ? I've got AC reading ints. Please change Assert(isdigit(s[i])); to Assert(isdigit(s[i]) || s[i] == '-'); and test if Assert will be called. |
|
|