|
|
back to boardDear autors or another users, i got WA#5, where is my bug ? this my solution: #include <iostream> #include <string> #include <stdlib.h> #include <algorithm> using namespace std; int main(){ int bilo; string s; cin>>s; for (int j = 0; j < s.length() - 1; j++){ bilo = 0; for (int i = 0; i < s.length()-1; i++){ if (s[i] != '1') if ((s[i] == s[i+1])){ s[i] = '1'; s[i+1] = '1'; bilo = 1;
if (i < s.length()-1){ rotate(&s[i], &s[i+1], &s[i] + s.length() - i); rotate(&s[i], &s[i+1], &s[i] + s.length() - i); } } } if (bilo = 0) break; }
int i = 0; while (s[i]!='1'){ cout<<s[i]; i++; }
//system("pause"); return 0; } please send me answer on my e-mail: sergeo_91_@mail.ru or write me here. P.S. thank you in advance. |
|
|