Contest 44: Crazy Calculator

Online C++ programming contests.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard, raimo

Postby Corsix » Thu Feb 10, 2005 9:43 am

I'm down to 213
edit: 210 - how did you guys get it lower??
edit2: 197 - this is getting silly
Last edited by Corsix on Thu Feb 10, 2005 10:18 am, edited 2 times in total.
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby exomo » Thu Feb 10, 2005 9:47 am

First working version: 238

Anybody wants to answer my question? (Darobat) I could save a million tokens if I knew.
Who needs a signature anyway.
User avatar
exomo
 
Posts: 879
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Postby Alvaro » Thu Feb 10, 2005 10:13 am

146, and it's getting steep.
User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Postby exomo » Thu Feb 10, 2005 1:23 pm

178
but I'm not sure about the headers I must include. I guess I have to include some more to make it run for Darobat.

And my code is nearly as obfuscated as the ones for the OCCs :twisted:

EDIT: just remove 2 more, 176
EDIT2: 174 but getting to the end now
Who needs a signature anyway.
User avatar
exomo
 
Posts: 879
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Postby Corsix » Thu Feb 10, 2005 2:32 pm

I'm on 170 and I can't find much more room for squishing...
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Darobat » Thu Feb 10, 2005 5:53 pm

exomo wrote:First working version: 238

Anybody wants to answer my question? (Darobat) I could save a million tokens if I knew.
Sorry. You won't have to worry about that. The direction will always point to another number or 'e'.
Code: Select all
#include <stdio.h>
struct W{char m,M[4??),w;void x(char
*W)??<w^=w;while(w[W]!=0)putchar(W[w
]^M[w++%5??));}W():m(040),w(0){char*
X="d@PLfAU\x05P)sHEMoTTPF""\31";for(
;w<5;w++[M??)=m++);x(X);}}w;main(){}
User avatar
Darobat
Moderator
 
Posts: 2572
Joined: Sat Sep 27, 2003 1:19 pm

Postby Beer Hunter » Thu Feb 10, 2005 11:43 pm

133 tokens. This is not counting that pesky '#include "stdafx.h"' that is required to compile in VS2003. (It's 136 tokens if you include that.) I've used a couple of VS2003-specific tricks to knock off 5 tokens. If I wanted this to compile in the average C++ compiler, it would be 138. In any case, I think I'm doing pretty well now!
User avatar
Beer Hunter
 
Posts: 912
Joined: Sat Dec 13, 2003 7:12 pm
Location: Australia

Postby exomo » Thu Feb 10, 2005 11:59 pm

so it can't be
Code: Select all
1 h 4 s   h 9 e
      2   3
      l 3 w

or something? no spaces between the calculation is very nice; I can remove 2 loops and checking and save some tokens.
Who needs a signature anyway.
User avatar
exomo
 
Posts: 879
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Postby Togra » Fri Feb 11, 2005 4:34 am

162, room for improvement. Big gap however to Alvaro and BH...

[edit]
Closing in fast: 144 :)
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

Postby exomo » Fri Feb 11, 2005 7:26 am

154 after removing the loops 8)
let's see if I can do some better
Who needs a signature anyway.
User avatar
exomo
 
Posts: 879
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Postby Darryl » Fri Feb 11, 2005 7:28 am

Beer Hunter wrote:133 tokens. This is not counting that pesky '#include "stdafx.h"' that is required to compile in VS2003. (It's 136 tokens if you include that.) I've used a couple of VS2003-specific tricks to knock off 5 tokens. If I wanted this to compile in the average C++ compiler, it would be 138. In any case, I think I'm doing pretty well now!


If you start with an empty project, you don't have to have that, alternatively since you already do, all you have to do is turn off pre-compile headers, then remove it.

Darryl
User avatar
Darryl
 
Posts: 1342
Joined: Wed Sep 01, 2004 10:50 am
Location: Cayman Islands

Postby gamma » Fri Feb 11, 2005 8:23 am

135. No known exploits of particular compiler.

Edit 00: 134
Edit 01: 132, The more tokens evaporate, the more I doubt my code for correctness.
Edit 02: 130
Edit 03: 127, still thinking it will run on any decent (ansi compliant) compiler.
Edit 04: 122
Edit 05: 116
Edit 06: 114
Edit 07: 108, with Corsix' hint which makes it non-ansi probably.
Edit 08: 106, again with thanks to Corsix.
Last edited by gamma on Sun Feb 13, 2005 1:47 pm, edited 7 times in total.
while (true){sleep(28800);work(57600);}
"Free" as in speech is so much better than "free" as in beer.
User avatar
gamma
 
Posts: 178
Joined: Mon Dec 01, 2003 9:16 am
Location: The Netherlands

Postby Alvaro » Fri Feb 11, 2005 9:47 am

141. I don't feel inspired. Also, I am not sure of the correctness of one particular trick I am using.

I want to see Gamma's code...
User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Postby Corsix » Fri Feb 11, 2005 9:50 am

144 (Nice clean code)

Edit: 133 - I'm catching....
Last edited by Corsix on Fri Feb 11, 2005 10:33 am, edited 1 time in total.
Code: Select all
#include <stdio.h>
char*_="XxTIHRCXCxTIHRXRCxTIHXHRCxTIXIHRCxTXTIHRCxXxTIHRCX";
int main(int l){for(l+=7;l!=putchar(010);++l);if(*(++_))main
(*_!=88?(putchar(*_^073)|putchar(33))&1:0xffff2a8b);}
User avatar
Corsix
 
Posts: 1181
Joined: Fri Jul 23, 2004 9:33 am
Location: Berkeley, UK

Postby Togra » Fri Feb 11, 2005 9:56 am

134

What's there to know about Darobats compiler? Anything weird (non-standard) about it?
Togra
 
Posts: 188
Joined: Wed Jul 28, 2004 8:51 am
Location: NL

PreviousNext

Return to Contests

Who is online

Users browsing this forum: No registered users and 1 guest