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

×

Can anyone please tell me what's wrong with my code?

include <iostream>

using namespace std;

int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin>>t; while(t--) { string s,ss; cin>>s>>ss; char a[ss.length()],b[s.length()],fix; if((s[0]=='0')||(ss[0]=='0')) { fix='1'; } else fix='0'; a[0]=b[0]=fix; for( int i=1;i<s.length();i++) { if((s[i]=='0')||(b[i-1]=='0')) { b[i]='1'; } else b[i]='0'; } for( int i=1;i<ss.length();i++) { if((ss[i]=='0')||(a[i-1]=='0')) { a[i]='1'; } else a[i]='0'; }

   int q;
   cin>>q;
   while(q--)
   {
      int l,m;
      cin>>l>>m;
      if(l==m)
      {
          cout<<a[0];
      }
      else
      {
          if(l>m)
          {
              cout<<a[l-m];
          }
          else
          {

                cout<<b[m-l];
          }
      }
   }
   cout<<"\n";

}

return 0; }

asked 19 Sep '18, 01:59

codingninja_x's gravatar image

4★codingninja_x
11
accept rate: 0%


plz use code writing filter it is provided on the taskbar of box .

then may be i will be able to read your code and tell you what error it is having

happy coding ; )

link

answered 19 Sep '18, 10:54

rajput1999's gravatar image

4★rajput1999
1936
accept rate: 0%

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:

×376
×3
×1

question asked: 19 Sep '18, 01:59

question was seen: 65 times

last updated: 19 Sep '18, 01:59