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

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


There is no input for given problem.


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.


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

(syntactically valid (but incorrect) submission)

hide comments
wardaddy1_: 2019-07-22 13:45:45

Last edit: 2019-07-22 13:57:29
Li Xiaofeng: 2018-05-30 16:13:37

@george_gkas0 You first submit A and B, then submit A and C.

zoso: 2018-01-07 21:20:52

@harsh_03 42 is the "answer to everything" https://simple.wikipedia.org/wiki/42_(answer)

harsh_03: 2017-12-13 22:29:12

What is so special with the number 42 ?

setsuda: 2016-08-12 21:07:15

Be careful! I got a WA because I copied the example output without fixing the obviously wrong changes.

arcane_achal: 2015-07-06 14:56:04

finally this problem AC.. after attempting so many frustrating problems

mattcroth: 2015-07-01 21:55:37

i solved one without having to look anything up, hooray

Last edit: 2015-07-01 21:59:43
kamran siddique: 2015-04-23 07:39:49

AC :)

george_gkas0: 2015-04-14 18:29:53

Ok so I solve the problem with 3 different solutions. The system takes the 2 and when I add the 3rd it gives me false answer. So I submit only the 2 solutions and I passed the problem. I am sure that the 3rd solution is correct and I want to sent it to you or in any other person who manage the problem. Is there any way to do it?

Santak: 2015-04-06 14:26:01

Got 3 soln. Not sure if any biwise operator can give a solution.

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