../ Competitive Programming
-rw-r--r--aguang705 B1 min read

modified

SPOJ 1 - TEST - Life, the Universe, and Everything

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

text
Input:
1
2
88
42
99

Output:
1
2
88

Solution

It's just for familiarizing yourself with this website.

Source Code

c
#include <stdio.h>

int main(int argc, char **argv) {

  int element;

  while (scanf("%d", &element) != EOF) {
		
    if (42 == element) {
      break;
    }
    printf("%d\n", element);
  }
 
 return 0;
} 

COMMAND INTERFACE

↑ ↓ navigate · Enter execute · Esc exit · try “whoami”

Loading filesystem…

:help aguang.xyz

A personal website disguised as an operating system.

Ctrl / Cmd + K
Command palette + full-text search
Tab / Shift + Tab
Move between links and controls
Enter
Open a focused link or search result
↑ / ↓ in search
Navigate search results
In a directory filter
Enter/Done or ↓ focuses a result; Esc clears the filter
Esc
Clear a search or close a window