[1337] Dumb Typo

  • Hello everyone who is partcipate in the Fighting For 2014 Contest, I'm MatRush. This is the simplest problem today, no algorithm knowledge needed, But it's also the hardest problem today if you are not on the right track, so please do not waste your time here if you have no idea with it after many tries.
    I was writing some C++ code one day, and I typed this fragment:

    x = y * 2 + 1;

    But unfortunately I had a bug. When y was 10, I wanted x to be 19. To fix this, I changed the '+' to a '-'.
    After fixing this bug, I wrote some more code:

    x = y * 2245 + (y * 2 - 7);

    I had a another bug. When y was 79, I wanted x to be 8841. What single character can I change to make this work? Remember your first answer as "pos,new char". For example, the answer to the first bug would be "10,-": we're changing the 10th (start from 0th) character ('+') to '-'.
    Several days later.
    I can't believe I made the same mistake again! Still this childish and straightforward code.

    x = y * 2245 + (y * 2 - 7);

    This time I had an another different bug. When y was 79, I wanted x to be 13186. What single character can I change to make this work? Remember your second answer as "pos,new char". For example, the answer to the first bug would be "10,-": we're changing the 10th (start from 0th) character ('+') to '-'.
  • 输入
  • There is no input
  • 输出
  • Please submit your two answer in separate lines (two lines).
  • 样例输入
  • There is no input
  • 样例输出
  • Sorry, no sample output.
    But I give you a wrong output for sample format. Here it is.
    1,-
    2,+

模拟就能做出来。               10,*

                                                8 ,0

                             0代表不能改变,1代表只能变成0~9数字里的或者只能改变符号,2代表符号数字都能变

                                                                            x = y * 2245 + (y * 2 - 7)

                                                                            0 0 0 1 1221 1  0 1 1 1 1

 空格也是字符,且是从第0个算起。

#include<iostream>
using namespace std;
int main()
{
cout<<"10,*"<<endl;
cout<<"8,0"<<endl;

}


                                                                       

你可能感兴趣的:([1337] Dumb Typo)