Contest 44: Crazy Calculator

Online C++ programming contests.

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

Postby Corsix » Fri Feb 11, 2005 10:36 am

Beating you by one token gamma - 131

Edit: 129
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 gamma » Fri Feb 11, 2005 11:05 am

@Togra:
Well, I know it is not that ansi compliant... Noticed that first hand from the obfuscation contests :(.

@Corsix:
Okay, I'll rethink...
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 exomo » Fri Feb 11, 2005 11:34 am

How can you do this? I can't go with 154 if you have 130.
I have to think about my algorithm again.
I still think mine is quite clever, but you are better 8)
Who needs a signature anyway.
User avatar
exomo
 
Posts: 881
Joined: Fri Sep 26, 2003 12:30 pm
Location: germany->baden

Postby Corsix » Fri Feb 11, 2005 11:41 am

Don't worry; look at what I thought:
I wrote:I'm down to 213
edit: 210 - how did you guys get it lower??
edit2: 197 - this is getting silly
Just keep on looing and thinking about the code and bash your head when required.
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 Alvaro » Fri Feb 11, 2005 11:58 am

136 and running out of ideas...
User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Postby Corsix » Fri Feb 11, 2005 12:04 pm

Could the almighty Alvaro be beaten?
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 Alvaro » Fri Feb 11, 2005 12:10 pm

I've been beaten before...

I have 127, though. But it doesn't work with all compilers, and I don't have MSVC++ 2003 .NET to test whether it works there or not. It works with g++ 2.95.2.
User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Postby Corsix » Fri Feb 11, 2005 12:25 pm

Send it do Darobat and ask him if it works on his compiler
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 gamma » Fri Feb 11, 2005 12:36 pm

122 and not yet of of ideas. I have the lead for now :mrgreen:.

Edit: I increased my lead: 116 :twisted:
Edit2: Down to 114. Running out of ideas :(
Edit3: 108. Using a hint from Corsix.
Edit4: 106. Using another hint from Corsix.
Last edited by gamma on Sun Feb 13, 2005 1:48 pm, edited 4 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 Corsix » Fri Feb 11, 2005 12:41 pm

122! Bloody hell...

edit: i gotta kill 11 tokens...
edit2: gotta kill 4 more tokens...
edit3: gotta kill 2 more tokens...
Last edited by Corsix on Fri Feb 11, 2005 2:49 pm, 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 Darryl » Fri Feb 11, 2005 2:00 pm

My code looks skimpy at 227, how the heck are you guys down to 100+ below that???

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

Postby Alvaro » Fri Feb 11, 2005 2:49 pm

125. It's hard to believe that it can be done in 116. I can't wait...
User avatar
Alvaro
Moderator
 
Posts: 5185
Joined: Mon Sep 22, 2003 4:57 pm
Location: NY, USA

Postby Darobat » Fri Feb 11, 2005 2:55 pm

OK, do you want me to remove the speed optimization? Everyone seems to be just optimizing for token count.
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 Corsix » Fri Feb 11, 2005 2:57 pm

votes[just_token_count]++; //Finding it hard to push below 118
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 Safari » Fri Feb 11, 2005 3:02 pm

Sorry but 1 token = 1 line? :oops:
User avatar
Safari
 
Posts: 1362
Joined: Sun Sep 19, 2004 11:07 am

PreviousNext

Return to Contests

Who is online

Users browsing this forum: No registered users and 0 guests