CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » December Cook-Off » Ciel and A-B Problem

Ciel and A-B Problem

Problem code: CIELAB

  • All Submissions

All submissions for this problem are available.

In Ciel's restaurant, a waiter is training. Since the waiter isn't good at arithmetic, sometimes he gives guests wrong change. Ciel gives him a simple problem. What is A-B (A minus B) ?

Surprisingly, his answer is wrong. To be more precise, his answer has exactly one wrong digit. Can you imagine this? Can you make the same mistake in this problem?

Input

An input contains 2 integers A and B.

Output

Print a wrong answer of A-B. Your answer must be a positive integer containing the same number of digits as the correct answer, and exactly one digit must differ from the correct answer. Leading zeros are not allowed. If there are multiple answers satisfying the above conditions, anyone will do.

Constraints

1 ? B < A ? 10000

Sample Input

5858 1234

Sample Output

1624

Output details

The correct answer of 5858-1234 is 4624. So, for instance, 2624, 4324, 4623, 4604 and 4629 will be accepted, but 0624, 624, 5858, 4624 and 04624 will be rejected.

Notes

The problem setter is also not good at arithmetic.


Author: laycurse
Date Added: 22-11-2011
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

I am new to codechef when to

ujjwal_invent @ 18 Dec 2011 10:07 PM
I am new to codechef when to stop taking inputs can somebody help or I should run infinite loop....

@ujjwal_invent all test cases

jingbo_adm @ 18 Dec 2011 10:09 PM
@ujjwal_invent all test cases are in different files. You just need to follow the INPUT STATEMENT. It tells you how to read data from the standard input.

@ujjwal_invent: Please check

admin @ 18 Dec 2011 10:10 PM

@ujjwal_invent: Please check the FAQ link http://www.codechef.com/wiki/faq#If_a_number_of_test_cases_isn-t_provide...

what if the right answer

niting112 @ 18 Dec 2011 10:26 PM
what if the right answer itself if of one digit eg 9-8=1? is 0 or 2 taken as right ?

@niting112 read the output

jingbo_adm @ 18 Dec 2011 10:30 PM
@niting112 read the output statement carefully.

4620 can be the answer?

ab1234 @ 18 Dec 2011 10:37 PM
4620 can be the answer?

do we need to check contraint

sharmasahil @ 18 Dec 2011 10:37 PM
do we need to check contraint <10,000 too

I am getting correct output

sharmasahil @ 18 Dec 2011 10:39 PM
I am getting correct output on my machine.stil its showin wrong answer.can u review it

@ab1234 Yes

jingbo_adm @ 18 Dec 2011 10:42 PM
@ab1234 Yes

@sharmasahil as you wish if

jingbo_adm @ 18 Dec 2011 10:43 PM
@sharmasahil as you wish if you think it may be necessary :) BTW, <=10,000

@sharmasahil there are many

jingbo_adm @ 18 Dec 2011 10:44 PM
@sharmasahil there are many other test cases :)

if input will be 12 10 then

tarun29061990 @ 18 Dec 2011 10:44 PM
if input will be 12 10 then what???

Does this problem have only

aarvay @ 18 Dec 2011 10:46 PM
Does this problem have only one test case? or several?

@aarvay only one in each

jingbo_adm @ 18 Dec 2011 10:48 PM
@aarvay only one in each file. and test many files by judge

@tarun29061990 any one from 1

jingbo_adm @ 18 Dec 2011 10:48 PM
@tarun29061990 any one from 1 to 9 will be OK

can 4625 be an answer for

bilalgce @ 18 Dec 2011 10:50 PM
can 4625 be an answer for sample inputs?

In the input file, first

niting112 @ 18 Dec 2011 10:50 PM
In the input file, first number is always A ?

@bilalgce Yes

jingbo_adm @ 18 Dec 2011 10:52 PM
@bilalgce Yes

@niting112 Yes

jingbo_adm @ 18 Dec 2011 10:52 PM
@niting112 Yes

yes !! finally got my first

niting112 @ 18 Dec 2011 10:59 PM
yes !! finally got my first answer in codechef !! Was missing some corner cases :)

Can B be greater than A ??

casy @ 18 Dec 2011 11:32 PM
Can B be greater than A ??

@casy No. please read the

hiroto_adm @ 18 Dec 2011 11:35 PM
@casy No. please read the statement

@admin; thankyou so much. got

sharmasahil @ 18 Dec 2011 11:54 PM
@admin; thankyou so much. got first tym correct soln.

What should be the answer for

casy @ 19 Dec 2011 12:00 AM
What should be the answer for 1234 1234 ?? 1 or something else

@casy read the input

jingbo_adm @ 19 Dec 2011 12:08 AM
@casy read the input statement

@casy read constraint

jingbo_adm @ 19 Dec 2011 12:09 AM
@casy read constraint

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com