•Teodor94
|
 |
« : Martie 30, 2014, 12:41:10 » |
|
Aici puteti discuta despre problema Beep.
|
|
|
Memorat
|
|
|
|
•raduraradu99
Strain
Karma: 0
Deconectat
Mesaje: 2
|
 |
« Răspunde #1 : Martie 30, 2014, 15:41:54 » |
|
Ce m-am mai chinuit sa vad de ce imi da Time limit exceeded la testul 5...  Pana la urma mi-am dat seama da poate sa iti ceara sa inlocuiesti "beep" cu "beep" si programul meu intra in ciclu infinit.  Am reparat si am retrimis sursa si am luat 100 de puncte! 
|
|
|
Memorat
|
|
|
|
•raduraradu99
Strain
Karma: 0
Deconectat
Mesaje: 2
|
 |
« Răspunde #2 : Martie 30, 2014, 15:43:19 » |
|
*"ca intra" nu "da intra"
|
|
|
Memorat
|
|
|
|
|
•rares96cheseli
Client obisnuit

Karma: 45
Deconectat
Mesaje: 60
|
 |
« Răspunde #4 : Martie 30, 2014, 20:38:15 » |
|
Nu sunt cazuri particulare. Cred ca ai un bug in sursa
|
|
|
Memorat
|
|
|
|
•alpi272003
Strain
Karma: 0
Deconectat
Mesaje: 1
|
 |
« Răspunde #5 : August 29, 2014, 09:46:51 » |
|
de ce primesc 0 pct?  ](*,
|
|
|
Memorat
|
|
|
|
•oldatlantian
Strain
Karma: 0
Deconectat
Mesaje: 13
|
 |
« Răspunde #6 : Noiembrie 27, 2014, 21:06:10 » |
|
Eu chiar nu pot intelege ce are sursa asta! #define STRMAX 1001 #include <cstdio> #include <cstring> using namespace std;
int strequal(char *str1, char *str2){ do{ if(*str1!=*str2) return 0; ++str1; ++str2; } while(*str1); return 1; }
int main(void){ freopen("beep.in","r",stdin); freopen("beep.out","w",stdout); char word[STRMAX],str[STRMAX]; scanf("%s",word); while(scanf("%s",str)!=EOF){ if(strequal(word,str)) printf("beep "); else printf("%s ",str); } return 0; }

|
|
|
Memorat
|
|
|
|
•PlayLikeNeverB4
|
 |
« Răspunde #7 : Noiembrie 28, 2014, 02:07:53 » |
|
Pai nu iti merge nici macar pe exemplu. Functia de comparare a stringurilor nu e buna. Gandeste-te ce se intampla daca str1 e prefix al lui str2.
|
|
|
Memorat
|
|
|
|
•tudorgalatan
Strain
Karma: -1
Deconectat
Mesaje: 27
|
 |
« Răspunde #8 : Februarie 12, 2016, 19:26:39 » |
|
Ce este greșit în această rezolvare? Pe un test îmi dă răspuns corect, dar la exemplu îmi afișează doar "Infoarena". #include <fstream> #include <cstring> #include <string>
using namespace std;
ifstream fin ("beep.in"); ofstream fout ("beep.out");
char word[50]; string s; unsigned short int n;
void read (); void solve (); void print ();
int main () { read (); solve (); print (); return 0; }
void read () { fin >> word; fin.get(); fin >> s; }
void solve () { n = strlen(word); while (s.find(word) != string::npos) s.replace (s.find(word), n, "beep"); }
void print () { fout << s; }
|
|
|
Memorat
|
|
|
|
•cyprc
Strain
Karma: 0
Deconectat
Mesaje: 1
|
 |
« Răspunde #9 : Septembrie 08, 2016, 16:25:06 » |
|
Salutare. Am cateva zile bune de cand imi bat capul sa imi dau seama ce gresesc dar nimic. Am verificat pe mai multe exemple si obtineam rezultatele asteptate. Totusi la evaluare trece un singur test, ceea ce mi se pare cam ciudat. Are cineva idee ce ratez? http://www.infoarena.ro/job_detail/1754756?action=view-source
|
|
« Ultima modificare: Septembrie 08, 2016, 17:17:39 de către Cristea Ciprian - Raul »
|
Memorat
|
|
|
|
•PlayLikeNeverB4
|
 |
« Răspunde #10 : Octombrie 02, 2016, 15:13:37 » |
|
Ma mir ca nu ai gasit niciun test. Uite unul. Raspuns:
|
|
|
Memorat
|
|
|
|
•SamySam2099
Strain
Karma: 0
Deconectat
Mesaje: 1
|
 |
« Răspunde #11 : Decembrie 02, 2016, 14:41:08 » |
|
#include <iostream> #include <fstream> #include <string.h> using namespace std; ifstream f("beep.in"); ofstream g("beep.out"); int contor(char s1[1000],char s2[1000]) { int k,c=0,n; n=strlen(s1); for(k=0;k<n;k++) { if(s1[k]==s2[k]) c++; } if(c==n) return 1; else return 0; } int main() { char cuv_interzis[1000],sir[1000],*p,m[1000][1000]; int j=0,n; f.getline(cuv_interzis,1000); f.getline(sir,1000); p=strtok(sir," "); while(p) { if(contor(p,cuv_interzis)==1) strcpy(m[j],"beep"); else strcpy(m[j],p); j++; p=strtok(NULL," "); } n=j; for(j=0;j<n;i++) { g<<m[j]<<' '; } return 0; }
|
|
|
Memorat
|
|
|
|
|