Sunday, September 20, 2009

Mooshak Clarifications

1. You have to register using your h200XXXX or f200XXXX id as username
and h200XXXX@bits-pilani.ac.in email-id only.
(Email to external email services not working, and
IDs except BITS ID will not be excepted).

2. You have to read from Standard Input and write to Standard Output. For example:

In C: 
...

int input input_integer, output_integer;
...
scanf("%d",&input_integer);
//for integer input
//see Input section in Problem Statement for
//input description.
...
...
printf("%d\n",output_integer);
...

In C++:
...
char input_character, output_character;
std::cin.get(input_character);
//read indivisual charecters and then integrate them.
//there are better ways too.
...
...
std::cout.put(output_character);
...

In Java:
...
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));

String input_line;
input_line=r.readLine();
//might have to be executed iteratively using r.read(char [], 0, 1) till
//white_space or end_of_line or end_of_file.
...
...
System.out.println(output_value);
...

In Python:
...
input_variable=raw_input()
...
print output_variable
...

Testing on your own pc:
Now, to test the cases in your own system, you'll have to generate a testcase file (simply copy the sample input). Let's assume it is input.txt.
Also, you want to save output in a file output.txt.
Use input output redirection. Example:

gcc mycode.c
./a.out< input >output.txt

g++ mycode.cpp
./a.outoutput.txt


javac mycode.java
java mycode output.txt

python mycode.py output.txt

Please note that commands and convensions will change according to OS used.

No comments:

Post a Comment