Show all threads Hide all threads Show all messages Hide all messages |
WA at Test# 8 | sanket bhandare | 1786. Sandro's Biography | 14 Oct 2020 11:28 | 1 |
Please help. what is test case 8. so that i can verify my answers. |
WA10 | Jumabek_Alihonov | 1786. Sandro's Biography | 17 Dec 2019 15:54 | 3 |
WA10 Jumabek_Alihonov 5 Apr 2012 18:12 I think here the line begins with something like: andro.... or ndroS.... |
If Wa7. | Hrayr | 1786. Sandro's Biography | 5 Apr 2019 14:19 | 4 |
Try this test : tTTTTT ans:60 Edited by author 27.06.2011 02:14 Thanks, that really helped :D Thanks for help. The problem were in checking substrings with length less then 6. |
TEST FOR WA4 | buyolitsez | 1786. Sandro's Biography | 12 Feb 2019 14:54 | 1 |
|
Не проходит шестой тест | Theodike | 1786. Sandro's Biography | 19 Dec 2018 01:28 | 1 |
Прошу помочь. Написал алгоритм на питоне, все придуманные мной примеры работают, однако шестой тест неумолим... Подскажите, где ошибка? Код прилагаю string = input() find = 'Sandro' lst = [] string = ' ' + string + ' ' def counter(indexInFind, indexInString): global string global find summ = 0 index = 0 temp='' for i in range(indexInString - indexInFind, indexInString - indexInFind + 6): if string[i] == ' ': return # if string[i] != find[index]: summ += 5 index += 1 temp += string[i] return summ if temp.find('S') != -1 or temp.find('s') != -1 else summ+5 for i in range(len(string)): strfind = find.find(string[i]) if strfind != -1: lst.append(counter(strfind, i)) print(min(lst) if len(lst) != 0 else 35) Edited by author 19.12.2018 01:29 Edited by author 19.12.2018 01:29 Edited by author 19.12.2018 01:31 |
WA#9 | dastan | 1786. Sandro's Biography | 24 Nov 2018 18:33 | 4 |
WA#9 dastan 4 Jan 2012 22:56 I have true answers on all tests with this forum, but have WA#9! Help me! This is my code: #include <iostream> using namespace std; int main() { char str[201]; int c = 0; int cmax = 0; int index = 0; const char S[7] = {'S','a','n','d','r','o','\n'}; gets(str); for(int i=0;i<strlen(str)-5;i++) { if(str[i]=='S') c+=2; if(str[i]=='s') c++; if(str[i+1]=='a') c+=2; if(str[i+1]=='A') c++; if(str[i+2]=='n') c+=2; if(str[i+2]=='N') c++; if(str[i+3]=='d') c+=2; if(str[i+3]=='D') c++; if(str[i+4]=='r') c+=2; if(str[i+4]=='R') c++; if(str[i+5]=='o') c+=2; if(str[i+5]=='O') c++; if(c>cmax) { cmax = c; index = i; } } c = 0; if((str[index]=='s')||((int(str[index])<=90)&&(str[index]!='S'))) c++; else if(str[index]!='S') c+=2;
if((str[index+1]=='A')||((int(str[index+1])>90)&&(str[index+1]!='a'))) c++; else if(str[index+1]!='a') c+=2;
if((str[index+2]=='N')||((int(str[index+2])>90)&&(str[index+2]!='n'))) c++; else if(str[index+2]!='n') c+=2;
if((str[index+3]=='D')||((int(str[index+3])>90)&&(str[index+3]!='d'))) c++; else if(str[index+3]!='d') c+=2;
if((str[index+4]=='R')||((int(str[index+4])>90)&&(str[index+4]!='r'))) c++; else if(str[index+4]!='r') c+=2;
if((str[index+5]=='O')||((int(str[index+5])>90)&&(str[index+5]!='o'))) c++; else if(str[index+5]!='o') c+=2; cout<<c*5<<endl; return 0; } Try the test: sssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnnnnnnnnnnnnndroooooooooooooo Your program's answer is 30. The right answer is 15. ( 1.sssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnnnnnnnnnnsnndroooooooooooooo 2.sssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnnnnnnnnnnsandroooooooooooooo 3.sssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnnnnnnnnnnSandroooooooooooooo ) The wierd thing is that for "mmndro" the answer is right. :D I got the bug. In the first for, your c is always increasing, so your cmax will be wrong. Put "c=0" before to close the for. It should work perfect now. |
nice tests | IlushaMax | 1786. Sandro's Biography | 23 Aug 2018 22:51 | 2 |
|
WA#19 can you help me? | Sorn | 1786. Sandro's Biography | 15 Jul 2017 02:42 | 2 |
#include<iostream> #include<string> using namespace std; int main () { string s; cin>>s; int max=0,i=0,index=0,a=0,p=0; for (i=0; i<s.size()-5; i++) { if(s[i]>'a' && s[i]<='z') p--; if(s[i]=='S') p+=2; if(s[i+1]=='a') p+=2; if(s[i+1]>='A' && s[i+1]<='Z') p--; if(s[i+2]=='n') p+=2; if(s[i+2]>='A' && s[i+2]<='Z') p--; if(s[i+3]=='d') p+=2; if(s[i+3]>='A' && s[i+3]<='Z') p--; if(s[i+4]=='r') p+=2; if(s[i+4]>='A' && s[i+4]<='Z') p--; if(s[i+5]=='o') p+=2; if(s[i+5]>='A' && s[i+5]<='Z') p--; if (p>max) { max=p; index=i; } p=0; } i=index; if (s[i]!='S' && s[i]>='A' && s[i]<='Z' || s[i]=='s') a+=5; else if (s[i]!='S' && s[i]>='a' && s[i]<='z') a+=10; if (s[i+1]!='a' && s[i+1]>='a' && s[i+1]<='z' || s[i+1]=='A') a+=5; else if (s[i+1]!='a' && s[i+1]>='A' && s[i+1]<='Z') a+=10; if (s[i+2]!='n' && s[i+2]>='a' && s[i+2]<='z' || s[i+2]=='N') a+=5; else if (s[i+2]!='n' && s[i+2]>='A' && s[i+2]<='Z') a+=10; if (s[i+3]!='d' && s[i+3]>='a' && s[i+3]<='z' || s[i+3]=='D') a+=5; else if (s[i+3]!='d' && s[i+3]>='A' && s[i+3]<='Z') a+=10; if (s[i+4]!='r' && s[i+4]>='a' && s[i+4]<='z' || s[i+4]=='R') a+=5; else if (s[i+4]!='r' && s[i+4]>='A' && s[i+4]<='Z') a+=10; if (s[i+5]!='o' && s[i+5]>='a' && s[i+5]<='z' || s[i+5]=='O') a+=5; else if (s[i+5]!='o' && s[i+5]>='A' && s[i+5]<='Z') a+=10; cout<<a<<endl; return 0; } Edited by author 30.12.2014 18:40 Edited by author 03.01.2015 17:13 Edited by author 03.01.2015 17:13 Try Dandro (must be 5, feeling like ur programm returns 10) |
22-ой тест не пошёл, помогите мне пожалуйста, уже и не знаю какие тесты вводить | Platt96 | 1786. Sandro's Biography | 20 Jul 2016 17:11 | 3 |
#include<iostream> #include<list> using namespace std; bool in_the_range(char a) { if (a >= 'a'&&a <= 'z') { return true; } else { return false; } } int chance_one_symb(char in_symbol, char out_sybmbol) { if ((in_the_range(in_symbol) && in_the_range(out_sybmbol)) || !(in_the_range(in_symbol)) && !(in_the_range(out_sybmbol))) { if (in_symbol == out_sybmbol) { return 0; } else { return 5; } } else { if (((int)in_symbol + 32) == out_sybmbol || ((int)in_symbol - 32) == out_sybmbol) { return 5; } else { return 10; } }
} int main() { char str[200] = { NULL }; const char word[6] = { 'S', 'a', 'n', 'd', 'r', 'o' }; int final_cost = 60, temp_cost = 0; cin.get(str, 200); list<char> temp; list<char>::iterator ptr; for (size_t i = 0; i < 6; i++) { temp.push_back(str[i]); } int j = 0; for (size_t i = 6; i <= strlen(str); i++) { for (ptr=temp.begin(); ptr!=temp.end(); ptr++) { temp_cost += chance_one_symb(*ptr, word[j]); if (temp_cost>=final_cost) { break; } j++; } j = 0; if (temp_cost < final_cost) { final_cost = temp_cost; } temp_cost = 0; temp.pop_front(); temp.push_back(str[i]); } cout << final_cost; return 0; } Edited by author 14.07.2016 22:33 Seeing a similar code on other tasks previously, i can already tell the problem by intuition. Try something like <194 symbols>Sandro. |
Just brute force | marik_karaev | 1786. Sandro's Biography | 22 Feb 2016 16:22 | 1 |
|
AC with DP | [RISE] Levon Oganesyan [RAU] | 1786. Sandro's Biography | 21 May 2014 01:42 | 1 |
AC with DP [RISE] Levon Oganesyan [RAU] 21 May 2014 01:42 I solve this problem with dp. Cool problem, similar to the Levenshtein,but with some differents. |
Levenshtein | staticor | 1786. Sandro's Biography | 28 Apr 2014 11:33 | 2 |
Not. This is not Levenshtein problem. It's different. |
wa test 4 | Shohin | 1786. Sandro's Biography | 28 Nov 2013 23:37 | 1 |
|
WA -8 ! | Iacob Vlad | 1786. Sandro's Biography | 29 Jan 2013 13:11 | 2 |
WA -8 ! Iacob Vlad 27 Nov 2011 20:45 first 7 tests are all strings of length 6. so if you wa 8, your program may not handle string of length > 6. |
wa#19. Give some tests, please! | shohruh_genius | 1786. Sandro's Biography | 15 Jan 2013 19:21 | 1 |
|
to admins | Anton | 1786. Sandro's Biography | 15 Jan 2013 14:04 | 3 |
Hi, guys! In the problem statement input is a string, that consists of a..z or A..Z. Let me guess, Test 7 has some other chars ? If so, please, correct prom statement with this note. 4 my submissions were with WA#7 until I added char check Test 7 consists of characters a..z and A..Z only. I had the same situation as topic starter. Maybe there is '\n' at the end of the test #7. |
WA #16. Please give me this test | Merzley | 1786. Sandro's Biography | 9 Aug 2012 17:16 | 1 |
|
WA 7 | Tsukanov | 1786. Sandro's Biography | 21 Apr 2012 03:50 | 1 |
WA 7 Tsukanov 21 Apr 2012 03:50 Can somebody help me? What's the problem? program BgrSandro; type t = 'A'..'Z'; const andro = 'andro'; lowcs=['a'..'z']; var i,j,c,min: integer; s: string; set1: set of t; Begin set1:=['A'..'Z'] - ['A','N','D','R','O']; readln(s); min:=20; for i:=1 to (Length(s)-5) do begin c:=0; if (s[i]<>'S') then begin inc(c); if (s[i]<>'s') and (s[i] in lowcs) then inc(c) end; for j:=1 to 5 do begin if (s[i+j]<>andro[j]) then begin inc(c); if (s[i+j] in set1) then inc(c) end end; if (c<min) then min:=c; end; writeln(min*5); end. Edited by author 21.04.2012 03:52 |
Got AC! | Hrayr | 1786. Sandro's Biography | 28 Dec 2011 14:59 | 3 |
Edited by author 27.06.2011 13:51 Apply the GOOD JOB for College ACMers to Make Large Money and Become a Millionaire Hello, We need large no. of dedicated and hard working ACMers. The payment is good so we need ACMers to be efficient. All you have to do to get the job is to sign up at our websites. The link of our websites are given below. http://www.PaisaLive.com/register.asp?3556638-4847933 After the registration, a confirmation email will be sent to your specified email address. Please click on the link inside the confirmation email to activate your account and recieve ACM work instantly. For any other queries you can mail the administrator. Miss Juliet Admin paisalive.com Re: Got AC! Anupam Ghosh, Wipro Technologies 28 Dec 2011 14:59 |
Got WA test # 16!!! HELP! | iCE Hin | 1786. Sandro's Biography | 30 Nov 2011 04:10 | 2 |
#include <cstdio> #include <cstring> char s1[10] = "Sandro", s2[10] = "sANDRO", l[205], n, a[10] = "Aaaaaa" , b[10] = "Zzzzzz"; int min = 60000; int main(){ scanf("%s", &l); n = strlen(l) - 5;
for ( int i = 0; i < n; i++ ){ int t = 0; for ( int j = 0; j < 6; j++ ){ if ( l[i+j] != s1[j] ){ if (!( l[i+j] == s2[j] || ( l[i+j] >= a[j] && l[i+j] <= b[j] ) )) t += 1; ++t; } } if ( t < min ) min = t; } printf("%d", min*5); scanf("\n"); return 0; } Edited by author 03.12.2011 02:02 Edited by author 03.12.2011 02:02 |