Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Solve using your language of choice

Name: Anonymous 2011-04-13 9:05

http://i56.tinypic.com/9qlh52.png

my solution in Java

import java.io.*;
import java.util.*;

public class ProblemF {
   
    public static void main(String[] args) throws Exception {
        BufferedReader fileIn = new BufferedReader(new FileReader("f.in"));
       
        String line = null;
        while ((line = fileIn.readLine()) != null) {
            int number = Integer.parseInt(line);
            if (number <= 0 || number >= 100000000) {
                break;
            }
            System.out.println(number +" : "+ getOrderedPairs(number));
        }
    }
   
    public static String getOrderedPairs(int number) {
        StringBuffer buff = new StringBuffer();
       
        int pairCount = 0;
        for (int i = 1; i <= number; i++) {
            for (int j = i; j <= number; j++) {
                int sum = getSummation(i, j);
                if (sum == number) {
                    pairCount++;
                    buff.append(" ("+ i +","+ j +")");
                    break;
                } else if (sum > number) {
                    break;
                }
            }
        }
       
        buff.insert(0, pairCount +" :");
       
        return buff.toString();
    }
   
    public static int getSummation(int tempA, int tempB) {
        int a = tempA - 1;
        int b = tempB;
        int sumB = ((b * (b + 1)) / 2);
        int sumA = ((a * (a + 1)) / 2);
        return sumB - sumA;
    }
   
}

Name: Anonymous 2011-04-14 17:15

>>40
[b]U FAIL AT MAKING FUN OF PEOPLE LOL[/b[

Name: Anonymous 2011-04-14 17:24

>>2,4-8,13-14,18,20,22,31,34-37

gtfo

this is /prog/, not /toy/

>>1,26,28

you can stay.

Name: Anonymous 2011-04-14 17:28

>>1,26,28,42-43

samefag

Name: Anonymous 2011-04-14 17:44

>>28 's algorithm in HASKAL (about 3 times slower than C)

import Data.List (foldl')
import System.Environment (getArgs)

fst4 (t, _, _, _) = t

orderedPairs :: Int -> [(Int,Int)]
orderedPairs m =
    fst4 $ foldl' (\ (xs, s, a, b) n ->
              let b' = n
                  s' = s+b'
                  (s'', a') = reduce (s', a)
              in if s''==m then ((a',b'):xs, s''-a', a'+1, b')
                           else (xs, s'', a', b')) ([], 0, 0, 0) [1..m]
    where reduce (s, a) =
              if s>m then reduce (s-a, a+1)
                     else (s, a)
                    
main :: IO ()
main = do
    args <- getArgs
    let n = read (head args)
    putStrLn $ show (orderedPairs n)

Name: Anonymous 2011-04-14 17:46

>>43
how about moe

Name: Anonymous 2011-04-14 18:03

>>28

; in: n = edx, edi = ptr to pairs
; out: edi = # of pairs
    xor eax, eax ; a
    xor ebx, ebx ; b
    xor ecx, ecx ; x
    mov esi, edi
    jmp inloop
nextloop:
    cmp ecx, edx
    jnz notfound
    stosd
    xchg eax, ebx
    stosd
    xchg eax, ebx
notfound:
    cmp ecx, edx
    jb xlessn
    sub ecx, eax
    inc eax
    jmp inloop
xlessn:
    inc ebx
    add ecx, ebx
inloop:
    cmp ebx, edx
    jbe nextloop
    sub edi, esi
    shr edi, 4
    ret

Name: Anonymous 2011-04-14 18:04

>>46
s/shr edi,4/shr edi,3/

Name: Anonymous 2011-04-14 18:07

>>42
Fuck you, I am not bound by the rules of your stupid game.

i like to drnikj sperm from my spermbottle while waring my sperm necklace" - u

FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME
FUCK YOU I WON'T DO WHAT YOU TELL ME


fucking fag

Name: Anonymous 2011-04-15 0:36

>>42
There's no reason to be afraid of languages with high-order features. If you can't take lambdas I'm afraid you're a bit of a retard when it comes to being a programmer. (Don't get me wrong, C is great... but only when you need it.)

Name: Anonymous 2011-04-15 1:04

>>49

Suck my dick faggot

Name: Anonymous 2011-04-15 2:37

>>50
Enjoy your toy language, `'faggot'`.

Name: Anonymous 2011-04-15 5:57

http://codepad.org/NVrG8cLJ
bf again, currently there are some overflow bugs. I will work on a better one

Name: Anonymous 2011-04-15 6:56

>>42
My code is pretty fast and portable, it's also better than OPs, so you can fuck off.
A language isn't a toy language, just because it's not popular in the ENTERPRISE.

Name: Anonymous 2011-04-15 13:42

DICENTIS,
 EGO SVM ABELSON ET SVSSMAN,
 PRIMVS ET RELIQVVS,
 CARVS ET CVDDARVS.

Name: Anonymous 2011-04-15 13:44

DICENTIS,
 EGO SVM ABELSON ET SVSSMAN,
 PRIMVS ET RELIQVVS,
 CARVS ET CVDDARVS.

Name: Anonymous 2011-04-15 13:46

DICENTIS,
 EGO SVM ABELSON ET SVSSMAN,
 PRIMVS ET RELIQVVS,
 CARVS ET CVDDARVS.

Name: Anonymous 2011-04-15 13:48

DICENTIS,
 EGO SVM ABELSON ET SVSSMAN,
 PRIMVS ET RELIQVVS,
 CARVS ET CVDDARVS.

Name: Anonymous 2011-04-15 13:49

DICENTIS,
 EGO SVM ABELSON ET SVSSMAN,
 PRIMVS ET RELIQVVS,
 CARVS ET CVDDARVS.

Name: Anonymous 2011-04-16 5:50

my face when this thread

Name: VIPPER 2011-04-16 6:02

>>59
Go die in a JEWS fire.

Name: Anonymous 2011-04-16 11:43

>mfw VIPPER is a huge fucking faggot

Name: Anonymous 2011-04-16 11:51

>>61
>mfw
and add noko to that. Oh my, aren't you a GIGANTIC FAGGOT. back to /b/, kid

Name: Anonymous 2011-04-16 17:03

`>mfw i am told to use noko on an imageboard
fuck you faggot

Name: Anonymous 2011-04-16 17:24

yo guise how do u upload images lol

Name: Anonymous 2011-04-16 17:33

And >>63 is the average imageboarder. The most peculiar characteristic of this subhuman species is the complete lack of any mental skill whatsoever.
As we can see, they refer as themselves as ``i'', and speak a strange language (most likely a subset/dialect of (US) English), composed of words like ``>mfw'', ``>implying'', ``noko'', whose meaning is still unknown.
They seem to be particularly unfriendly, calling everyone a ``faggot'' (or ``fag'', in their language), but in the context of their restricted minds, it may be an act of courtesy. This may justify the complete lack of sage in their posts.
They also seem to have a strange fetish for green-coloured text.

Name: Anonymous 2011-04-16 17:43

>>65
`>implying im from the imageboards
`>mfw your butthurt

Name: Anonymous 2011-04-16 17:49

>>66
Thank you, you too!

Name: Anonymous 2011-04-16 18:49

>>65
>mfw your implying your not a faggot

Name: Anonymous 2011-04-17 2:50

>>68
U MENA FAGGOTFAG

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List