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

×

It's showing "Time Limit Exceeded" error.....how can I solve it?

include <iostream>

include <bits stdc++.h="">

using namespace std; string func(string l, char array[]){ int n = l.length(); strcpy(array, l.c_str()); return array; } int main() { int t; cin>>t; while(t--){ int n; cin>>n; string s; cin>>s; char array[n]; func(s,array); int i; for(i=0;i<n;i+2){ char g = array[i]; array[i] = array[i+1]; array[i+1] = g; }

        switch(array[i]){
           case 'a':
            array[i]= 'z';
            break;
            case 'b':
            array[i]= 'y';
            break;
            case 'c':
            array[i]= 'x';
            break;
            case 'z':
            array[i]= 'a';
            break;
            }

    for(i=0;i<n;++i){
        cout<<array[i];
    }
    cout<<endl;
}
return 0;

}

asked 11 Jan, 20:13

sanskarag's gravatar image

0★sanskarag
-1
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:

×814
×629
×101
×96

question asked: 11 Jan, 20:13

question was seen: 44 times

last updated: 11 Jan, 20:13