Sunday, December 22, 2013

codechef CIELAB - "Ciel and A-B Problem" solution

codechef CIELAB - "Ciel and A-B Problem": http://www.codechef.com/problems/CIELAB

my c++ solution to codechef CIELAB - "Ciel and A-B Problem": http://ideone.com/zPkaCz
#include <iostream>
using namespace std;

int main() {
// your code goes here
int a, b;
cin>>a>>b;
if((a-b)%10==9) cout<<(a-b)-1;
else cout<<(a-b)+1;
return 0;
}

5 comments:

  1. sir can you give this programme in c language

    ReplyDelete
  2. i don't see why you chose that if condition?

    ReplyDelete
  3. if((a-b)%10==0) cout<<(a-b)+1;
    else cout<<(a-b)-1;

    The above condition is not working. Why?

    ReplyDelete