You are not logged in. Please login at www.codechef.com to post your questions!

×

Can You Figure this Out?

Problem : https://www.codechef.com/problems/CIELAB

My solution : https://www.codechef.com/viewsolution/21674491

Can you please point out the error in my solution; I have used a very basic logic mostly you'll understand it ! THANKS .

asked 22 Nov '18, 11:33

prembharwani's gravatar image

2★prembharwani
195
accept rate: 0%

1

your logic is perfect only one mistake is there you are taking t that is number of testcases from user which is not required for this question see sample test case!

(22 Nov '18, 12:50) bhayanak_atma5★

So simple, You are taking three(3) inputs where as input specifies only two(2). Why are you taking T number of test cases... Always read question twice before attempting it. Dont blindly post your doubts.

this code will work:-

 #include<iostream>
    using namespace std;
    int main()
    {int t;

     int a,b;
                cin>>a>>b;
            int n=a-b;
            if((n%10)!=9){cout<<n+1<<endl;}

                      else{cout<<n-1<<endl;}



    return 0;
    }
link

answered 22 Nov '18, 12:49

codesniper99's gravatar image

3★codesniper99
1186
accept rate: 7%

edited 22 Nov '18, 12:50

Thanks for bringing the error into notice !

(22 Nov '18, 17:45) prembharwani2★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,901
×21
×20

question asked: 22 Nov '18, 11:33

question was seen: 77 times

last updated: 22 Nov '18, 17:45