Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programming Challenge (Out-of-Date)
New Posts  All Forums:Forum Nav:

Programming Challenge (Out-of-Date) - Page 4  

Poll Results: Are you interested in participating in and/or helping organise and post these programming challenges?

 
  • 100% (2)
    I want to participate.
  • 0% (0)
    I want to contribute by helping posting and organise these challenges.
  • 0% (0)
    I'll only take part if other people are willing to participate.
  • 0% (0)
    I can help and participate - I love programming!
  • 0% (0)
    I do not wish to participate or help.
2 Total Votes  
post #31 of 306
If we use some of the ACM challenges I don't think it'll matter that the answers can be found. You would be able to tell if they and you can find the answers to a lot of small programming problems with some searching.
If you have some challenges that could be used, then please post them or provide a link so we can start organizing everything!
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
post #32 of 306
Thread Starter 
Please send all suggestions via PM to Hobo or myself. If we post them here members will be able to get a head-start and potentially ruin a time based challenge. Hopefully we can get this rolling again.
Main Rig
(15 items)
 
  
Main Rig
(15 items)
 
  
post #33 of 306
If you guys are interested in more programming challenges for the time being, check out www.hackthissite.org and click on "Programming" missions on the left hand side.
post #34 of 306
Not to beat a dead horse, but I just noticed this thread (haven't been on this site in months). Tried the first one; took a while, mostly because it's haha, my first python program (learning, after years of java). Not perfect but working and...readable

Code:
import sys

input = "1,2,3,5,10,11,12,13,25,26"

if len(sys.argv) > 1:
    input = sys.argv[1]

list = input.split(",")

output = ""
run = 0

for i in range(0, len(list)):
    if i == 0 or output[-1] == ",":
        output += list[i]

    elif int(list[i]) == int(list[i-1]) + 1:
        run = 1
        pass

    else: 
        if run:
            output += "-" + list[i-1]
        output += "," + list[i]
        run = 0

if run:
    output += "-" + list[-1]

print output
iMac
(13 items)
 
  
CPUGraphicsRAMMonitor
i7-2600 6970M 4GB 27" 
Mouse
Logitech M570 trackball 
  hide details  
iMac
(13 items)
 
  
CPUGraphicsRAMMonitor
i7-2600 6970M 4GB 27" 
Mouse
Logitech M570 trackball 
  hide details  
post #35 of 306
Ok I did the third one (screw pascal, hehe).

First time I went through all the numbers divisible by that big factor, then checked each for palindromicityness Took FOREVER...

Code:
def isPalindrome(num):
    return str(num) == str(num)[::-1]

factor = 11*13*17*19*23*29
max = 99999999999999999999

quotient = max / factor
num = factor * quotient

while not isPalindrome(num):
    quotient = quotient - 1
    num = factor * (quotient)
    print "testing " + str(num)

print "found it: " + str(num)
Second time I went through all the palindromes and checked for division...MUCH quicker...

Code:
import sys

factor = 11*13*17*19*23*29

for a in range(9,0,-1):
    for b in range(9,0,-1):
        for c in range(9,0,-1):
            for d in range(9,0,-1):
                for e in range(9,0,-1):
                    for f in range(9,0,-1):
                        for g in range(9,0,-1):
                            for h in range(9,0,-1):
                                for i in range(9,0,-1):
                                    for j in range(9,0,-1):
                                        num = 10000000000000000001 * a + 
                                               1000000000000000010 * b + 
                                                100000000000000100 * c + 
                                                 10000000000001000 * d + 
                                                  1000000000010000 * e + 
                                                   100000000100000 * f + 
                                                    10000001000000 * g + 
                                                     1000010000000 * h + 
                                                      100100000000 * i + 
                                                       11000000000 * j;
                                        if num % factor == 0:
                                            print "found it: " + str(num)
                                            sys.exit(0)
Code:
$ time p 2a.py
found it: 99976239844893267999

real    0m7.547s
user    0m7.506s
sys     0m0.033s
iMac
(13 items)
 
  
CPUGraphicsRAMMonitor
i7-2600 6970M 4GB 27" 
Mouse
Logitech M570 trackball 
  hide details  
iMac
(13 items)
 
  
CPUGraphicsRAMMonitor
i7-2600 6970M 4GB 27" 
Mouse
Logitech M570 trackball 
  hide details  
post #36 of 306
Quote:
Originally Posted by ouroboros1827 View Post
Not to beat a dead horse, but I just noticed this thread (haven't been on this site in months). Tried the first one; took a while, mostly because it's haha, my first python program (learning, after years of java). Not perfect but working and...readable

Code:
import sys

input = "1,2,3,5,10,11,12,13,25,26"

if len(sys.argv) > 1:
    input = sys.argv[1]

list = input.split(",")

output = ""
run = 0

for i in range(0, len(list)):
    if i == 0 or output[-1] == ",":
        output += list[i]

    elif int(list[i]) == int(list[i-1]) + 1:
        run = 1
        pass

    else: 
        if run:
            output += "-" + list[i-1]
        output += "," + list[i]
        run = 0

if run:
    output += "-" + list[-1]

print output
For fun I did the first one too. Used ruby
Code:
#!/usr/bin/env ruby

org = ARGV.to_s.split(/,s*/).map {|n| n.to_i}.sort.uniq
con = org.first.to_s
one = true
for n in 1...org.size.to_i
    if org[n].to_i > org[n-1]+1
        con.concat "#{org[n-1]},#{org[n]}" if not one
        con.concat ",#{org[n]}" if one
        one = true 
    elsif one
        con.concat "-" and one = false
    end    
end
p con
Code:
anomaly  [~]  
$ time ruby convert.rb 1,2,8,4,12,34,15,17,16
"1-2,4,8,12,15-17,34"

real    0m0.004s
user    0m0.000s
sys     0m0.004s
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
post #37 of 306
Just to give everyone a bit of a heads up, I plan to post a challenge Thursday (July 24) around 8pm EST. The dead line then I'm still not sure on. More details will come when the challenge is posted. I just wanted to give a heads up so no one (hopefully) sees the challenge at the last minute.
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
post #38 of 306
Quote:
Originally Posted by dangerousHobo View Post
Just to give everyone a bit of a heads up, I plan to post a challenge Thursday (July 24) around 8pm EST. The dead line then I'm still not sure on. More details will come when the challenge is posted. I just wanted to give a heads up so no one (hopefully) sees the challenge at the last minute.

will you post to this thread so we can get a subscription email?
RAWR
(13 items)
 
Home Server
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-4790k msi z97 gaming 7 gtx 760 4gb 32GB GSkill  
Hard DriveHard DriveCoolingOS
Kingston HyperX 3K 120GB SSD Hitachi 2TB Cooler Master Hyper 212+ Windows 8.1 Pro 
MonitorKeyboardPowerCase
Vizio M492-b2 Logitech Wireless  Corsair HX620 NZXT Phantom White 
Mouse
Logitech Wireless 
  hide details  
RAWR
(13 items)
 
Home Server
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-4790k msi z97 gaming 7 gtx 760 4gb 32GB GSkill  
Hard DriveHard DriveCoolingOS
Kingston HyperX 3K 120GB SSD Hitachi 2TB Cooler Master Hyper 212+ Windows 8.1 Pro 
MonitorKeyboardPowerCase
Vizio M492-b2 Logitech Wireless  Corsair HX620 NZXT Phantom White 
Mouse
Logitech Wireless 
  hide details  
post #39 of 306
Quote:
Originally Posted by hometoast View Post
will you post to this thread so we can get a subscription email?
Yes, I will post the challenge here in this thread.
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
post #40 of 306
Hey everyone, here is the new challenge. This one did not sound to difficult, but I don't know what everyones skill level here is.

The challenge:
Create a program to convert a given dollar amount to written amounts. For example, the input $72.61 would output "seventy two dollars and sixty one cents". The dollar amount will be under $1000.00, so your program should be able to handle any dollar amount smaller then that.

Creativity, efficiency and elegance are weighed to decide the winner.

Any language is welcome.

It does not matter how you let someone enter an amount to your program, just as long as it has a dollar sign($) and a decimal point.



Deadline:
Wednesday July 30th at 11:59pm EST.

Wait to post your solutions till it's closer to the deadline. You don't want to give away how you solved it!
(We'll wait for a 24 hour challenge to see who can solve something first)

I plan to post another challenge then next Thursday at the same time (8:00pm ish EST).


Post any questions you have.

If this is too easy or too hard then please let me know!
Edited by dangerousHobo - 7/24/08 at 6:50pm
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
This thread is locked  
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programming Challenge (Out-of-Date)