I am trying to find out the the no of permutations possible for a string that are palindrome.The only way I could think of is finding out the possible permutations and then checking if each one of them is palindrome or not. Is there any better way?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 160 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
8 | awoo | 154 |
10 | luogu_official | 151 |
I am trying to find out the the no of permutations possible for a string that are palindrome.The only way I could think of is finding out the possible permutations and then checking if each one of them is palindrome or not. Is there any better way?
Hello I am trying to solve the question :http://www.spoj.com/problems/PT07Z/ in SPOJ. I have used bfs to find the leaf node and then used bfs again to find the maximum path.I am trying this approach and I don't know what is causing the error. Here is a link to my solution http://ideone.com/QSJzDf.
I was solving maximum quad area in SPOJ. Here is the link http://www.spoj.com/problems/QUADAREA/. It is a pretty simple one based on formula. However when I used the formula in C++ it showed WA. But the same formula and same logic showed acc when i used scanf and printf. Is there something I am missing? Here are the links to the codes: with cin: http://ideone.com/kSPbfU without cin: http://ideone.com/uF0yiK
I am trying to solve the problem RENT on SPOJ. Here is the link http://www.spoj.com/problems/RENT/.I have done it using dynamic programming and binary search. I cant figure out what is wrong with my code.Here is a link to my code : http://ideone.com/UgnBRN . Please Help.
I am trying to solve SPOJ street parade. But i dont know what is wrong in the following code:
#include<iostream>
#include<algorithm>
#include<stack>
#include<cstdio>
using namespace std;
int main(){
int n,ne,last;
cin>>n;
while(n!=0){
int ar[n];
last=0;
stack <int> s;
for(int i=0;i<n;i++)
cin>>ar[i];
for(int i=0;i<n;i++){
if(s.top()==(last+1)){
s.pop();
last++;
}
else if(ar[i]==(last+1))
last++;
else if(!s.empty() && s.top()<ar[i]){
cout<<"no"<<endl;
continue;
}
else
s.push(ar[i]);
}
cout<<"yes"<<endl;
cin>>n;
}
return 0;
}
Название |
---|