Sphere Online Judge

Computer geeks! Show off your skills and claim the job of your dreams! RecruitCoders.com

SPOJ Problem Set (classical)

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

Added by:Micha³ Ma³afiejski
Date:2004-05-01
Time limit:10s
Source limit:50000B
Languages:All
Resource:Douglas Adams, The Hitchhiker's Guide to the Galaxy

hide comments
2012-05-24 10:10:30 Nnavneetsinha
@Rajat Don.t put code in comment put it in the forum.Anyways, from the code it seems that u haven't read the problem carefully .read it again.
2012-05-16 09:54:28 Rajat Kamra
#include <stdio.h>
main()
{
int a,i=0;
scanf("%d",&a);

while(a!=42)
{
scanf("%d",&a);
i++;
}

if(a==42)
{
return 0;


}
return 0;
}
what isw wrong wid dis?
2012-05-16 08:09:59 Sehajdeep singh
how many numbers we have to write?????
2012-05-13 03:26:15 ananyadiwas
what's problem in importing java.util....I am unable to find out,when i submitted i got a compilation error..even then my logic is correct.please do help me,getting same thing with each and every program on spoj.What should i do for my code to be accepted in java or c or c++
2012-05-02 07:54:37 Lalit
i'm repeatedly getting runtime error.should we sort the input processed before 42????PLZZ HELP
2012-04-26 07:03:26 steven_w
program ex1;
var
i,j:longint;
begin
i:=0;
while i<>42 do
begin
readln(i);
writeln(i);
end;
end.
2012-04-11 14:58:59 Jimmy Swanick
I submitted my solution and got a compilation error... It worked when I ran it on my computer; was there some problem importing java.util? or is there something else that went wrong? As far as I can test it, the program works, so I don't know what to change.
2012-04-09 15:19:35 Jitendra
I submitted this problem and I got Compilation error, while I have run same successfully. Where I have to compile it? I have used both C and then C++.


Last edit: 2012-04-09 15:23:25
2012-04-08 14:40:36 love
i tried to figure everyout every possible mistake but it is still not working pls tell why it showing wrong ifanswer code is right.......
2012-04-05 13:46:55 eXerigumo Clanjor
My brainf**k solution TLE :(
SPOJ System © 2012 Sphere Research Labs | Projekty informatyczne i aplikacje na zamówienie. All Rights Reserved.