Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › The Programming Challenge Master Thread
New Posts  All Forums:Forum Nav:

The Programming Challenge Master Thread - Page 25

post #241 of 263
Just found out the challanges are up again, it will be nice to put myself in trouble hehe!
I'll go with PHP preferably since I almost forgot what I learned in C++ thumbsdownsmileyanim.gif
post #242 of 263
Quote:
Originally Posted by Icekilla View Post

R = (A+B) + (A-B) + (B+A) + (B-A)
It's harder than you think].

No it's not.

In Python
Code:
def easy(A, B):
    return (A+B) + (A-B) + (B+A) + (B-A)

Easy.
Back in Black
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 965 BE (C3) Biostar TA790GX A3+ Sapphire HD 5770 (v2) CORSAIR XMS3 4GB DDR3 
Hard DriveOptical DriveOSMonitor
WD Caviar Black 640GB Sony Optiarc CD/DVD RW Windows 7 Ultimate x64 NEC MultiSync LCD 1960NXi 
KeyboardPowerCaseMouse
Microsoft Comfort Curve Keyboard 2000 Corsair 650TX Cooler Master Storm Scout Logitech MX 400 Laser 
  hide details  
Reply
Back in Black
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 965 BE (C3) Biostar TA790GX A3+ Sapphire HD 5770 (v2) CORSAIR XMS3 4GB DDR3 
Hard DriveOptical DriveOSMonitor
WD Caviar Black 640GB Sony Optiarc CD/DVD RW Windows 7 Ultimate x64 NEC MultiSync LCD 1960NXi 
KeyboardPowerCaseMouse
Microsoft Comfort Curve Keyboard 2000 Corsair 650TX Cooler Master Storm Scout Logitech MX 400 Laser 
  hide details  
Reply
post #243 of 263
Quote:
Originally Posted by Chris++ View Post

No it's not.
In Python
Code:
def easy(A, B):
    return (A+B) + (A-B) + (B+A) + (B-A)
Easy.

Also trying to understand what could possibly be difficult about that challenge and what the relevance is of the input rules. Perhaps it's meant to restrict input, although if that's the case then resulting behavior should be defined.

But you forgot to include the "hard" part for getting input, parsing it, and printing. tongue.gif

Perl
Code:
my $input = <>;
$input =~ /^(\d+)\s(\d+)$/;
print (($1+$2) + ($1-$2) + ($2+$1) + ($2-$1));
     
CPUMotherboardGraphicsRAM
Intel Core i7-4770K Gigabyte G1.Sniper M5 EVGA GTX 780 SC Crucial Ballistix Sport 2 x 8GB 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro 256GB Seagate Barracuda 3TB Seagate Barracuda 4TB Asus BD-ROM 
CoolingOSMonitorKeyboard
Noctua NH-D14 Windows 8 Pro Dell U2713HM Ducky YOTD (MX Brown) 
PowerCaseMouseMouse Pad
SeaSonic SS-760XP2 Fractal Design Arc Mini Roccat Savu SteelSeries 9HD 
Audio
Beyerdynamic DT990 250 Ohm 
CPUMotherboardGraphicsRAM
AMD A6-3500 Asrock A75M HD 6530D Samsung 4GB DDR3 1600  
Hard DriveHard DriveHard DriveOptical Drive
Intel 320 80GB Samsung Spinpoint F4 2TB WD Caviar Green 3TB Sony BD-Rom 
CoolingOSMonitorKeyboard
Noctua NH-C12P SE14 Win 7 Professional 64-bit Samsung LN46C600 Lenovo N5902 
PowerCaseOther
Corsair CX430 Antec Veris Fusion HDHomeRun Prime 
CPUMotherboardGraphicsRAM
AMD Phenom II X3 B55 Asus M5A99X EVO Sapphire HD 7950 G.Skill 8GB DDR3 
Hard DriveOptical DriveCoolingMonitor
Samsung F3 1TB LG DVD-RW CM Hyper 212 Plus Dell U2312HM 
KeyboardPowerCaseMouse
Pink KBT Race (MX Blue) Lepa G700-MA Corsair 500R Razer Abyssus 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
     
CPUMotherboardGraphicsRAM
Intel Core i7-4770K Gigabyte G1.Sniper M5 EVGA GTX 780 SC Crucial Ballistix Sport 2 x 8GB 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro 256GB Seagate Barracuda 3TB Seagate Barracuda 4TB Asus BD-ROM 
CoolingOSMonitorKeyboard
Noctua NH-D14 Windows 8 Pro Dell U2713HM Ducky YOTD (MX Brown) 
PowerCaseMouseMouse Pad
SeaSonic SS-760XP2 Fractal Design Arc Mini Roccat Savu SteelSeries 9HD 
Audio
Beyerdynamic DT990 250 Ohm 
CPUMotherboardGraphicsRAM
AMD A6-3500 Asrock A75M HD 6530D Samsung 4GB DDR3 1600  
Hard DriveHard DriveHard DriveOptical Drive
Intel 320 80GB Samsung Spinpoint F4 2TB WD Caviar Green 3TB Sony BD-Rom 
CoolingOSMonitorKeyboard
Noctua NH-C12P SE14 Win 7 Professional 64-bit Samsung LN46C600 Lenovo N5902 
PowerCaseOther
Corsair CX430 Antec Veris Fusion HDHomeRun Prime 
CPUMotherboardGraphicsRAM
AMD Phenom II X3 B55 Asus M5A99X EVO Sapphire HD 7950 G.Skill 8GB DDR3 
Hard DriveOptical DriveCoolingMonitor
Samsung F3 1TB LG DVD-RW CM Hyper 212 Plus Dell U2312HM 
KeyboardPowerCaseMouse
Pink KBT Race (MX Blue) Lepa G700-MA Corsair 500R Razer Abyssus 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #244 of 263
Quote:
Originally Posted by Icekilla View Post

I have a challenge for you

Given two numbers A and B, 1 <= A, B <= 10^9, you must find the following calculation:
R = (A+B) + (A-B) + (B+A) + (B-A)

Data input
The only line of the input is two space separated numbers, A and B.

Data output
The only line of the output is the result of the calculation, R.

Input samples
10 5

Output samples
30

It's harder than you think, took it from COJ.

I don't possibly see what is hard about that, especially if you simplify first to: 2*(A+B)
 
Tragbar
(14 items)
 
 
CPUMotherboardGraphicsRAM
Ryzen 1800X Asus Crosshair VI Hero Nvidia Geforce Titan X F4-3600C15D-16GTZ 
Hard DriveHard DriveHard DriveHard Drive
Combined: 6.13 TB of space Samsung SSD 960 EVO 500GB Crucial_CT1050MX300SSD1 M4-CT128M4SSD2 
CoolingCoolingCoolingCooling
EK-Supremacy EVO White Edition PrimoChill PrimoFlex Advanced LRT EK-RES X4 250 (R2.0) Reservoir EK-CoolStream XE 360 
CoolingCoolingCoolingOS
EK-Vardar F4-120ER (2200rpm)  EK-Ekoolant EVO Liquid Coolant EK-XTOP Revo D5 PWM Pump Windows 10 Pro 
MonitorKeyboardPowerCase
Asus VG278H Ducky YOTG Keyboard Corsair AX1200 Corsair Obsidian 800D 
MouseAudioAudioAudio
Logitech G700s Schiit Gungnir Multibit Schiit Mjolnir 2 Schiit LISST 
Audio
Audeze LCD 2 - pre fazor 
CPUMotherboardGraphicsRAM
intel i7 4770K ASRock Z87E-ITX Nvidia Geforce GTX Titan X GSkill F3-2400C10D-16GTX R 
Hard DriveOptical DriveCoolingOS
Samsung 840 Pro 512GB Silverstone 12.7mm Slot Load Blu-Ray Burner Noctua NH-L12 Windows 8 Pro 
MonitorCaseAudioAudio
LG PA75U Slim LED Projector Silverstone SG08 Schiit Bifrost Schiit Asgard 2 
AudioOther
AKG Q701 Headphones Pelican 1510 Green Case  
  hide details  
Reply
 
Tragbar
(14 items)
 
 
CPUMotherboardGraphicsRAM
Ryzen 1800X Asus Crosshair VI Hero Nvidia Geforce Titan X F4-3600C15D-16GTZ 
Hard DriveHard DriveHard DriveHard Drive
Combined: 6.13 TB of space Samsung SSD 960 EVO 500GB Crucial_CT1050MX300SSD1 M4-CT128M4SSD2 
CoolingCoolingCoolingCooling
EK-Supremacy EVO White Edition PrimoChill PrimoFlex Advanced LRT EK-RES X4 250 (R2.0) Reservoir EK-CoolStream XE 360 
CoolingCoolingCoolingOS
EK-Vardar F4-120ER (2200rpm)  EK-Ekoolant EVO Liquid Coolant EK-XTOP Revo D5 PWM Pump Windows 10 Pro 
MonitorKeyboardPowerCase
Asus VG278H Ducky YOTG Keyboard Corsair AX1200 Corsair Obsidian 800D 
MouseAudioAudioAudio
Logitech G700s Schiit Gungnir Multibit Schiit Mjolnir 2 Schiit LISST 
Audio
Audeze LCD 2 - pre fazor 
CPUMotherboardGraphicsRAM
intel i7 4770K ASRock Z87E-ITX Nvidia Geforce GTX Titan X GSkill F3-2400C10D-16GTX R 
Hard DriveOptical DriveCoolingOS
Samsung 840 Pro 512GB Silverstone 12.7mm Slot Load Blu-Ray Burner Noctua NH-L12 Windows 8 Pro 
MonitorCaseAudioAudio
LG PA75U Slim LED Projector Silverstone SG08 Schiit Bifrost Schiit Asgard 2 
AudioOther
AKG Q701 Headphones Pelican 1510 Green Case  
  hide details  
Reply
post #245 of 263
Know this is a bump, but I miss the challenges. Is there going to be any more?
post #246 of 263
Thread Starter 
Quote:
Originally Posted by 3930K View Post

Know this is a bump, but I miss the challenges. Is there going to be any more?

I am busy with a few projects of my own for the next month, at least. If I find anything from those that I could possibly post as a challenge, otherwise I won't be posting anything before the last week of June.
However, if someone else wants to post a programming challenge (like Plan9 and Bobicon did earlier), that would be great.
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #247 of 263
Quote:
Originally Posted by {Unregistered} View Post

Quote:
Originally Posted by 3930K View Post

Know this is a bump, but I miss the challenges. Is there going to be any more?

I am busy with a few projects of my own for the next month, at least. If I find anything from those that I could possibly post as a challenge, otherwise I won't be posting anything before the last week of June.
However, if someone else wants to post a programming challenge (like Plan9 and Bobicon did earlier), that would be great.

Thanks smile.gif
post #248 of 263
post #249 of 263
i only joined this site this past week but i just saw this thread for the first time so better late than never for challenge #1 smile.gif i used TRACE instead of printf...

void MakeStars(int MaxStars)
{
CString StarChars;
for(int i=0; i<(MaxStars+MaxStars); (i< MaxStars) ? StarChars += "*" : StarChars = StarChars.Left(StarChars.GetLength()-1), TRACE("%s\n", StarChars), ++i) {}
}
post #250 of 263
@Plan9 can you create another challenge? I need something to kill some time tongue.gif
Project Arch
(16 items)
 
BigByte
(8 items)
 
Macbook Pro
(8 items)
 
CPUMotherboardGraphicsRAM
Intel i7 5960x @ 4.8ghz Asus X99-E WS 2 x Nvidia Quadro K6000 Corsair Dominator Platinum 64gb 2666 
Hard DriveCoolingOSMonitor
2 x Samsung 850 Pro 512gb {RAID 0} Swiftech H320 w/ Noctua NF-F12 iPPC Arch Linux w/ OpenBox 2 x LG 31MU97 Cinema 4K 
KeyboardPowerCaseMouse
Vortex KBC Poker II PBT EVGA SuperNOVA 1000 G2 Corsair Obsidian 450D Zowie FK1 
Mouse PadAudioAudioOther
Steelseries QCK+ Beyerdynamic DT 770 Pro 80Ω Audioengine D1 Intel X540-T2 NIC 
CPUMotherboardRAMHard Drive
Intel Avoton C2750 Octa-Core ASRock C2750D4I Samsung 64gb ECC 1600mhz 8 x Samsung 850 Pro 1TB 
OSPowerCaseOther
FreeNAS SilverStone ST45SF-G 450w SilverStone DS380 Intel X540-T2 NIC 
CPUGraphicsGraphicsRAM
Intel i7-4960HQ Intel Iris 5200 Pro NVIDIA GT 750M 2gb 16gb (2x8gb) 1600mhz 
Hard DriveMonitorMouseMouse Pad
1tb PCIe SSD 15.4" {2880x1800} IPS SteelSeries Sensei [RAW] SteelSeries QcK Mini 
  hide details  
Reply
Project Arch
(16 items)
 
BigByte
(8 items)
 
Macbook Pro
(8 items)
 
CPUMotherboardGraphicsRAM
Intel i7 5960x @ 4.8ghz Asus X99-E WS 2 x Nvidia Quadro K6000 Corsair Dominator Platinum 64gb 2666 
Hard DriveCoolingOSMonitor
2 x Samsung 850 Pro 512gb {RAID 0} Swiftech H320 w/ Noctua NF-F12 iPPC Arch Linux w/ OpenBox 2 x LG 31MU97 Cinema 4K 
KeyboardPowerCaseMouse
Vortex KBC Poker II PBT EVGA SuperNOVA 1000 G2 Corsair Obsidian 450D Zowie FK1 
Mouse PadAudioAudioOther
Steelseries QCK+ Beyerdynamic DT 770 Pro 80Ω Audioengine D1 Intel X540-T2 NIC 
CPUMotherboardRAMHard Drive
Intel Avoton C2750 Octa-Core ASRock C2750D4I Samsung 64gb ECC 1600mhz 8 x Samsung 850 Pro 1TB 
OSPowerCaseOther
FreeNAS SilverStone ST45SF-G 450w SilverStone DS380 Intel X540-T2 NIC 
CPUGraphicsGraphicsRAM
Intel i7-4960HQ Intel Iris 5200 Pro NVIDIA GT 750M 2gb 16gb (2x8gb) 1600mhz 
Hard DriveMonitorMouseMouse Pad
1tb PCIe SSD 15.4" {2880x1800} IPS SteelSeries Sensei [RAW] SteelSeries QcK Mini 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › The Programming Challenge Master Thread