Created
April 24, 2010 20:58
-
-
Save livingston/377936 to your computer and use it in GitHub Desktop.
SPOJ 1. Life, the Universe, and Everything
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 1. Life, the Universe, and Everything | |
Problem code: TEST | |
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. | |
More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. | |
All numbers at input are integers of one or two digits. | |
Example: | |
Input: 1 2 88 42 99 | |
Output: 1 2 88 | |
*/ | |
var SPOJ_01 = function () { | |
var result = '', len = arguments.length, args = [].reverse.call(arguments), value; | |
while(len--) { | |
value = args[len]; | |
if(value !== 42) { | |
result += value + ' '; | |
} | |
} | |
return result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With Ada.Text_IO; Use Ada.Text_IO;
With Ada.Integer_Text_IO; Use Ada.Integer_Text_IO;
-- your code goes here
var SPOJ-01 = function () {
var result = '', len = arguments.length, args = Array.prototype.reverse.call(arguments), value;
while(len--) {
value = args[len];
if(value !== 42) {
result += value + ' ';
}
}
};