1 / 24
Oct 2005

it looke like I am not the only one having trouble with this one. I have gotten my answer down to a single space, but hours poring over C references have not been fruitful beyond this.

  • created

    Oct '05
  • last reply

    Aug '21
  • 23

    replies

  • 948

    views

  • 16

    users

  • 1

    link

The problem was only added less than two weeks ago. I think giving hints for this problem would be a bad idea since it's so simple and hints would make it trivial.

when a problem specifies "C Code" but doesn't use the judge's gcc, does it have to be C for that version of gcc?

No, this is standard C. You can't use any gcc extensions, so something like "typeof" won't work. Btw, both of your solutions are buggy, sparr0.

19 days later

Hmmm... What is the authoritative reference for your "Standard C"?

The ultimate "reference" is my judge program. wink
Both solutions are valid C90 (ISO 9899:1990) and C99 (ISO 9899:1999). At least one of them wouldn't work in certain traditional (pre-standard) compilers but I doubt anyone of you uses a >20 years old compiler.

17 days later

i have figured out one solution ...........
but the other one i am finding it tough .........

the hardest part of this problem is testing. since mauke says both of my solutions are buggy im guessing something i used is part of GCC extensions but not C99, which means ive found 0 instead of 1 solution. if i had a "standard" compiler to throw ideas at id probably take another look at this one, but until then im not quite up to the task of re-reading the standards.

-Wall -ansi -pedantic

to gcc does a good job of identifying non-ANSI constructs. Give it a try, anyway.

Or maybe it means that your answer doesn't actually declare the right kind of type under any compiler.

1 month later

I found the obvious/**/solution, any hints on the second part? Especially, a clarification what is and what isn't whitespace would be really nice.

Huhu, I found the "obvious" other solution first; the /**/ thing was an afterthought. I'm pretty sure that whitespaceless C is turing-complete, even without preprocessor tricks like comments.

"Whitespace" is a sequence of 1 or more white characters. White characters recognized by the judge include: ' ' (space), '\t', (tab), '\n' (newline), '\r' (carriage return), '\f' (form feed) and '\v' (vertical tab). No other ASCII char is white, but there may be other white characters such as char 160 (non-breaking space); I haven't tested those.

A general comment: '\0' (NUL) isn't whitespace. It can't be used to separate tokens either. (I don't care if this works in gcc.)

1 month later

No, but I'd like to see you use #define without putting whitespace between it and the following identifier...

Oops, I know how to do it, but it's still not allowed: The problem description asks for a declaration/type definition. #define is just token replacement.

Ok. And another one.
Does right solution work correctly on C++? (I'm just have no normal C compiler for experiments:) )

10 months later

I have a question.
How much different should the two submissions be? My submissions gives WA even if I used two distinct tricks.

14 days later

Pardon the revival of this thread, but do we use
"char * const"
or
"const char *"
? The description is rather ambiguous about this, and I think I am being rejected because I may have the wrong one (it makes a huge difference to the token-parsing and stuff, and the amount of hackish things you need to make it work)

3 months later

nneonneo, it's char*const. meaning a pointer to char that can't point anywhere else, but the thing pointed to can change.

besides /**/, what else have you come up with?

1 month later

I came up with a solution ( and read misof's solution for the other trick). I am able to compile the solution with gcc 3.3.3 but I am getting WA.

4 years later

typedef/**/struct{unsigned/**/aku;char/**/*const/**/soku}zan;
typedef/**/struct{unsigned(aku);char*const(soku)}zan;

Can someone point out whats wrong with these declarations....I am going mad with this problem.... frowning spoj.pl/status/HAJIME,saurabh8c/3