-
Counting
Welcome, this is a challange for the coders here, The idea is to write a program that will count to the number in the section you are entering in.
The rules are as follows:
* No one is to share there code
* No one is to copy anyone else's program
* You are to write your program yourself but you may get help from friends.
The sections are:
* Visual Basic
- 1 Million
- 2 Million
- 5 Million
- 10 Million
- 100 Million
* C & C++
- 1 Million
- 2 Million
- 5 Million
- 10 Million
- 100 Million
* Other languages
- 1 Million
- 2 Million
- 5 Million
- 10 Million
- 100 Million
*your program must make a record of the numbers it counts, wether it displays this or saves a document it is upto you.
To enter make your program and e-mail myself at tbcscomp@gmail.com with your program compiled into an EXE and the source code so i can verify your entry.
I will compile a results table for each section after the compition has ended (19th,Apr,2008 ) and a winner announced.
All programs will be run on my test system to get an accurate result after the comp has ended, a winner will be announced within one week of ending.
And the most important part, Have fun.
-
Re: Counting
Questions for this competition:
- Purpose: Is the goal to write the most elegant code, the spiffiest program, or the fastest running.
- Hardware: are we limited in our usage of equiptment. (ie: one computer only or can we botnet a whole company in a distributed computing super-cluster)
-
Re: Counting
the purpose is to count to the target as fast as possable, and as for hardware the tables i produce will be for desktops/laptops and one for special pc's IE Clusters
My records sofar are:
1million: 8 seconds
2million: 12 seconds
5million: 26 seconds
10million: 56 seconds
and 1 billion is still running after 1 hour, and is currently writting a file sitting at 8.2GB sofar, but i don't know what number it is upto as i have my program set to ignore everything but counting.
Also mine is coded in VB6, i got to find a way to use dual cores.
-
Re: Counting
XcOM, did you get this Idea from me? Haha, I will start work immediately.
-
Re: Counting
Why do I have a feeling I'm going to have to learn multithreading now.....
Should I take a link down to my C code which counts (doesn't store to a file though)?
EDIT: Also does the version of C/C++ use matter?
-
Re: Counting
Well, My program just told me it took 3.625 Seconds to count to 1 million
Programmed in VB6
This is WITHOUT multi threading
From the values below, you can see it is almost linear relationship between which number you count to and how long it takes. In fact, you will notice that if you multiply the 100 Million time by 5 it is actually longer then what 500 Million took.
System specs: 2.3 GHz Athlon 64 X2
My Records
1 Million: 3.406 Seconds
2 Million: 7.047 Seconds
5 Million: 17.906 Seconds
10 Million: 34.562 Seconds
100 Million: 394.563 Seconds
500 Million: 1887.578 Seconds
1 Billion: 3732.39 Seconds = 62.2 Minutes 12GB file
-
Re: Counting
Who wants a headache?
This is a slight violation of the rules, but I don't think too many people are going to benefit from it.
My program counts from 0 to 1,000,000 in roughly .5 seconds, while storing these values into a .txt file
my code, for anyone who dares:
Code:
import java.util.*;
import java.io.*;
import java.lang.management.*;
class ${int _;char O=(char)0X0A;boolean $=!(1!=0%1);String __$=""+'$';
char O(int x){return(char)(x*83+32);}char O1(int x){return(char)((x<<1)+99);}
char l0(int x){return(char)(x+100);}int l01(int y){return(y==1?10:10*l01(--y));}
public static void main(String args[])throws Exception{new $();}$()throws Exception{
long $_=$_();toilet=$$();_%=1;for(;!$;)_();
toilet.flush(); //always a must
_$_(($_()-$_)*.01/(15^5)/(117&(55<<1))/(64|36)/(11^111)
+""+O(0)+O(1)+O1(1)+O1(0)+l0(11)+l0(10)+l0(0)+O(1)+O);}
void _()throws Exception{toilet.write(_+""+O);++_;$=(_>l01(6));}
long $_(){return t.getCurrentThreadCpuTime();}
void _$_(Object x){__().print(x);}
PrintStream __(){return System.out;}
BufferedWriter $$()throws Exception{return new BufferedWriter(new FileWriter(__$));}
ThreadMXBean t=ManagementFactory.getThreadMXBean();
BufferedWriter toilet;}
And yes, it is syntactically correct, compiles, and does what it is described as doing.
To run it, just copy the code into a file called $.java, then compile it, and run it. This will output the time taken, and the numbers will be in a new file which it creates.
Have fun:D
-
Re: Counting
Well, I'm not going to even touch that.
I would really like to learn Java though. I'm currently working on that actually.
-
Re: Counting
Java gives me a headache... most likely because I don't know how to program it.
Currently I'm holding off this comp because of the fact I need to complete my C assignment. If you want the source code of the program(for my assignment) I'm working on, I'll be happy to share it after Friday 5PM (last day it's due). Just PM me asking for it.
-
Re: Counting
weazel6265, yes definitely gave me headache.:) Have you ever heard of the International Obfuscated C Code Contest and here? Your program reminded me of it. The fact that you came up with that is pretty impressive. I'm guessing you're not just a hobby programmer.