BCEASY - Bottom Coder (Easy)

no tags 

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.

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

The code you are supposed to modify:

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

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!)

Input

There is no input for given problem.

Output

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:

The first occurrence of the letter Q is found, the input is split into two parts. Any whitespace in each of the parts is removed. It is checked whether the two submissions differ and whether each of them was obtained from the original program by an allowed change. Each of your two submissions is compared to each of the three correct solutions.

Example

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

(syntactically valid (but incorrect) submission)


hide comments
Lalit: 2015-03-30 22:32:03

Got two sol -both by replacing char ;)

(Tjandra Satria Gunawan)(曾毅昆): 2015-02-24 13:03:55

is this problem fit in the riddle section? there are THINK; THINKBIT; THINKX; THINKLOL; with pretty similar task: "Edit source code", and all THINK* are in riddle section!

ওয়াসী (Wasi): 2013-08-21 14:03:14

@Tjandra i have a 4th solution that is also rejected by the judge!
cause it prints 43 astericks :P
Can't find any other solutions except those three :(

(Tjandra Satria Gunawan)(曾毅昆): 2013-08-20 23:48:33

Very nice problem! Found all 3 solutions. Need some golfing knowledge to get AC ;-)
btw @fuster: Could you tell me your 4th solution that rejected? I'm curious if there some other solution than thoose 3.

deepindb: 2013-06-24 16:46:01

why I only can input the text? the language can't be select..

fuster: 2013-03-22 09:54:28

I have found _4(four)_ solutions to this problem. Unfortunately, only three of them are accepted.

code zebra: 2012-08-14 12:18:11

is there a solution by deleting a character?

Siddharth Sinha: 2012-07-01 07:57:42

got the three solutions but getting WA....even after writing Q at the appropriate place

Last edit: 2012-07-01 07:58:21
Julian Leyh: 2012-02-09 10:26:34

found three solutions, two with replacing a character, and one with adding a character :)

anonymous: 2011-08-08 22:12:35

Should I write a program which prints that code or should that code be the actual submission ?


Added by:Roman Sol
Date:2005-05-13
Time limit:0.100s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:TEXT
Resource:IPSC 2005