IPSC Logo

Internet Problem Solving Contest

IPSC 2005

Problem B – Bottom Coder

Some of you may be familiar with the TopCoder (TM) contest. Its exact rules are not important for this problem, but know that the most important part of it is writing a program according to the given specification. Many times the contestant ends up with a program which would work perfectly – if only he could change a couple of characters (like, replacing "=" by "==" in C, etc.). Unfortunately, even the best programmers sometimes aren't able to spot these tiny but necessary changes until it's too late... and that's why we developed a brand-new BottomCoder training for them!

The idea is very simple – you're given a problem specification, a source code, and a list of permitted modifications. Your task is to find a modification which would cause the program to behave according to the specification.


Easy problem

Specification: "Write a program which outputs EXACTLY 42 asterisks and NOTHING more (e.g. NO end-of-line markers, like "\n", ...)"

The input file contains the code you are supposed to modify.

As this is a really, really simple problem, you are only permitted to make exactly ONE of these modifications to the source: 1) Add one character to the source. 2) Delete one character from the source. 3) Replace one character in the source by a different one.

Moreover, it would be definitely too easy if we asked you to find just one solution, so you'll need to find TWO DIFFERENT solutions in order to obtain credit for this problem. (There are exactly three different solutions, so don't worry, it can be done!)

Your submission should consist of two parts. The first part should contain the first of your solutions. A single line with the letter "Q" follows. (Note that the letter Q is used as a separator. You will have to do without inserting the letter Q in at least one of your solutions :) After this line you should add your second solution.

You don't need to worry much about the exact formatting of your submission. The exact judging procedure will look as follows:

For example, a syntactically valid (but incorrect) submission might look like this:

int i, n=42; main(
){ for(i=0; i<n; i--)   { printf("?"); } }
QQQ
int i, n=41; main() { for(i=0; i<n;i--) { printf("*"); } }


Hard problem

Specification: "Write a program which outputs a short English text mentioning our partner competition – IPSC. The text must consist of one or more English sentences and each sentence has to contain one or more English words (sequences of only upper-case characters) separated by spaces. Additionally, you may use certain punctuaction characters – namely ".!?,'". Try to obfuscate the program as much as possible."

The input file contains the code you are supposed to modify. As you can see, the coder made almost everything according to the specification :)

You're only allowed to alter one number in the source code – namely the number 47 on line 98 (the argument of function "f10" called from "main"). You can replace it by any integer between 100`000`000 and 200`000`000 inclusive.

Your submission should consist of two lines. The first line should contain the value of the constant – an integer between 100`000`000 and 200`000`000 inclusive. The second line should contain the output produced by the program if it were compiled and executed with the correct value of the constant.

Example of a syntactically valid (but incorrect) submission:

123456789
ARE YOU SOLVING IPSC PROBLEMS RIGHT NOW?


Notes on C

Here are some additional notes for those of you who are not that familiar with the C language.


Credits:
Problemsetter(s): g00ber, misof
Contest-related materials: g00ber, Bee