| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA#8 | Tom | 1567. SMS-спам | 12 окт 2014 01:01 | 5 |
WA#8 Tom 6 авг 2011 19:46 what s wrong this time ? anybody ? #include<iostream> #include<string> using namespace std; char napis[1001]={0}; char tab[35]={0}; int tab1[35]={0}; int main(){ tab[0]=*"a"; tab1[0]=1; tab[1]=*"b"; tab1[1]=2; tab[2]=*"c"; tab1[2]=3; tab[3]=*"d"; tab1[3]=1; tab[4]=*"e"; tab1[4]=2; tab[5]=*"f"; tab1[5]=3; tab[6]=*"g"; tab1[6]=1; tab[7]=*"h"; tab1[7]=2; tab[8]=*"i"; tab1[8]=3; tab[9]=*"j"; tab1[9]=1; tab[10]=*"k"; tab1[10]=2; tab[11]=*"l"; tab1[11]=3; tab[12]=*"m"; tab1[12]=1; tab[13]=*"n"; tab1[13]=2; tab[14]=*"o"; tab1[14]=3; tab[15]=*"p"; tab1[15]=1; tab[16]=*"q"; tab1[16]=2; tab[17]=*"r"; tab1[17]=3; tab[18]=*"s"; tab1[18]=1; tab[19]=*"t"; tab1[19]=2; tab[20]=*"u"; tab1[20]=3; tab[21]=*"v"; tab1[21]=1; tab[22]=*"w"; tab1[22]=2; tab[23]=*"x"; tab1[23]=3; tab[24]=*"y"; tab1[24]=1; tab[25]=*"z"; tab1[25]=2; tab[26]=*"."; tab1[26]=1; tab[27]=*","; tab1[27]=2; tab[28]=*"!"; tab1[28]=3; tab[29]=*" "; tab1[29]=1;
int i=0,j=0,k=0,licznik=0; cin.getline (napis, 1000); k = strlen(napis); for(i=k-1;i>=0;i--){ for(j=0;j<30;j++){ if(napis[i]==tab[j]){ licznik+=tab1[j]; } } napis[i]=0; } cout << licznik; getchar(); return 0; } salam navid,dasdet dard nakone AC gereftam!!!! cena. Thx, but i can not understand why this has helped) After two minutes I realized ... '\0' symbol :D Edited by author 12.10.2014 01:03 |
| Explanation | naik | 1260. Фотограф-зануда | 11 окт 2014 23:40 | 1 |
This problem solved with the left edge. We look for position of "2". We have three cases: 1) 12***** - "2" in the second position 2) 1*2**** - "2" in the third position 1**2*** - "2" in the fourth position is impossible 1***2** - "2" in the fifth position is impossible 3) 1******2 - "2" in the last position is possible (the one special case). For example: 1357642 For each case find sub-task: 1) a[i-1] 2) is NOT a[i-2] For 1*2**** there can only be one 132****, more accurate 1324***. Therefore is a[i-3]. 3) is 1 Recurrent expression: a[i] = a[i-1] + a[i-3] + 1. And a precalculation: a[1] = 1 a[2] = 1 a[3] = 2 A some answers to compare: a[4] = 4 a[5] = 6 a[6] = 9 a[7] = 14 |
| confusion | Garegin | 1820. Уральские бифштексы | 11 окт 2014 21:48 | 1 |
what is the difference?? to count as whole stakes or to count it with side. as i think this is the same problem but we get different answers to this question. |
| Contest problems | Levon Oganesyan | | 11 окт 2014 21:22 | 1 |
Who knows when the contest problems will be avaible in the Archieve? |
| Может быть, баги в тестах? | Teacher30 (Burunduk1) | 2013. Не взбалтывать и не смешивать | 11 окт 2014 15:09 | 2 |
Проблема была в скорости чтения данных. Почему так? У меня на компе работало 0.25 секунд на max тесте. |
| TaskD | LDV Soft | | 11 окт 2014 14:30 | 1 |
TaskD LDV Soft 11 окт 2014 14:30 Если 2 человека пытаются заплатить за квартиру нечётной стоимости, что происходит? |
| новые задачи to admins | kostan3 | | 10 окт 2014 16:43 | 1 |
что ели кто то наример я захочу добавить задачу в архив что необходимо для этого делать? |
| This problem is a joke? | thiendeptrai | 1196. Экзамен по истории | 10 окт 2014 11:08 | 2 |
I tried everything to do that but i got TLE, and then MLE. So I used index table with 1024*1024 elements and got AC. But the problem said that 10^9. Maybe it's a joke ? the promblem has been rejudged, heh, you lost ac |
| how 90 came | Samuel | 1012. K-ичные числа. Версия 2 | 10 окт 2014 00:15 | 2 |
Hello problem is to find the summ of all k-based numbers? Edited by author 30.04.2014 12:54 to find the amount of "right" k-based numbers. "right" - those numbers that do not have to zeros in sequence |
| solution and explanation | xoptutorials.com/index.php/category/timus/ | 1545. Иероглифы | 9 окт 2014 18:09 | 1 |
Find the solution and explanation of this task in manyprogrammingtutorials.blogspot.com |
| WA TEST#1 | fotol | 1880. Собственные числа Psych Up | 9 окт 2014 17:47 | 3 |
program sdf; var n,n1,n2,n3,i,i1,i2,k,a:integer; m,m1,m2,e:array[1..1000 ] of integer; begin k:=1; readln(n1); For i:=1 to n1 do readln(m[i]); readln(n2); For i:=1 to n2 do readln(m1[i]); readln(n3); For i:=1 to n3 do readln(m2[i]); For i:=1 to n1 do for i1:=1 to n2 do for i2:=1 to n3 do begin if (m[i]=m1[i1]) and (m1[i1]=m2[i2]) and (m[i]+m1[i1]+m[i2]<>-3) Then begin e[k]:=m[i]; k:=k+1; m[i]:=-1; m1[i1]:=-1; m2[i2]:=-1; end; end;
For i:=1 to k do begin for i1:=i+1 to k do begin if e[i]=e[i1] Then e[i1]:=-1; end; end; For i:=1 to k-1 do begin if e[i]<>-1 Then a:=a+1; end; writeln(a); end. в ЧЕМ ошибка? почитай руководство. возможно, ошибка лишь в том, что написал "program sdf;". |
| WA3 | Dusayarov Alisher | 1010. Дискретная функция | 9 окт 2014 16:12 | 1 |
WA3 Dusayarov Alisher 9 окт 2014 16:12 What is test 3??? Help me!!! Please!!! |
| How can i read input in C++ (my code doesn't work) | papaga3 | 1242. Оборотень | 8 окт 2014 23:35 | 2 |
int victim; while (scanf("%d", &victim) != EOF) { /*do something*/ } it is an infinite loop scanf returns: number of the read charecter in finish scanf return 0 but EOF value is -1 |
| WA#16 Please give me some tests | Bakhtiyorbek Begmatov | 1788. О пользе зонтов | 8 окт 2014 14:35 | 2 |
|
| Help me,about the standard input | Ural | 1007. Кодовые слова | 8 окт 2014 11:22 | 2 |
How can I know the input is finished? It doesn't get the data from file,I can't use : ifstream in("*.in"); in.eof(); |
| These tests helped me | Maria Pandele | 1499. Треуголки | 8 окт 2014 01:09 | 1 |
10 3 1 5 10 6 8 6 16 4 16 13 2 11 9 2 7 3 17 6 4 7 3 9 2 9 1 11 17 12 17 14 10 3 3 5 7 2 8 1 |
| hint | Levon Oganesyan | 1351. Хороший гнусмас – мёртвый гнусмас | 8 окт 2014 01:08 | 1 |
hint Levon Oganesyan 8 окт 2014 01:08 You can solve this problem in integers, without any angles. |
| Hard tests | ValentinPerm | 1351. Хороший гнусмас – мёртвый гнусмас | 8 окт 2014 01:06 | 2 |
input#1: 30000 30000 29999 -29999 -30000 12 19999 19996 19999 19997 19999 19998 19999 19999 19999 20000 19999 20001 19999 20002 19999 20003 19998 19996 19998 19997 19998 19998 19998 19999 output#1: YES YES YES NO NO NO NO NO YES YES NO NO input#2: 30000 29999 30000 -30000 -29999 12 19999 19996 19999 19997 19999 19998 19999 19999 19999 20000 19999 20001 19999 20002 19999 20003 19998 19996 19998 19997 19998 19998 19998 19999 ouput#2: NO NO NO NO YES YES YES YES NO NO NO YES |
| Ошибка на тесте 3 | JaleChaki | 2009. Очереди в столовой | 7 окт 2014 21:31 | 1 |
Люди, помогите, на 3 тесте ошибка |
| Find A Multiple Problem. Anyone got a better than O(N^2) algo.? | tau | 1032. Найдите кратное | 7 окт 2014 16:54 | 14 |
Could someone help me. I've tried to solve the problem using a classical Lee approach and for the worst case when the numbers are very small (eg. 1 or 2), the program takes about 4 secs on my PII-350. The Dirichlet method of solving isn't a better solution because it has the same complexity. Could someone give me a hint on optimizing my algorithm or if you got a better solution could you please forward it. Thankz. In this problem you need to note 2 things: 1) There is always solution. 2) The solution is always a continuous sequence. > In this problem you need to note 2 things: > 1) There is always solution. > 2) The solution is always a continuous sequence. Thanks you. > > In this problem you need to note 2 things: > > 1) There is always solution. > > 2) The solution is always a continuous sequence. > > Thanks you. I can't understand 2) The solution is always a continuous sequence. What means continuous sequence? ex) 1. 4 5 6 7 8 9 or 2. Input[4], Input[5], Input[6], Input[7], Input[8], Input[9]? I don't know.. Give me more hints... > ex) 1. 4 5 6 7 8 9 > or > 2. Input[4], Input[5], Input[6], Input[7], Input[8], > Input[9]? It's the second one. S[i]= (input[1]+input[2]+..+input[i]) mod n; If you can find i such as s[i]=0; it's ok. If not, you always find i, j: s[i]=s[j]; The sol is input[i+1]...input[j]. OK?
Why the answer is such a sequence of input? Is it impossible that : input[1],input[7],input[9]....... Thanks. > It's the second one. > S[i]= (input[1]+input[2]+..+input[i]) mod n; > If you can find i such as s[i]=0; it's ok. > If not, you always find i, j: s[i]=s[j]; > The sol is input[i+1]...input[j]. OK? > > Thank you! UXMRI: Sergey Baskakov, Raphail Akhmedisheff and Denis Nikonorov 10 апр 2005 15:18 I got AC. Your explanation is perfect! I think, I would have never invented anything better than O(n^2) myself. Thanks once again! rafailka. why it's always a continuous sequence? Edited by author 07.10.2014 17:00 > Could someone help me. I've tried to solve the problem > using a classical Lee approach and for the worst case > when the numbers are very small (eg. 1 or 2), the program > takes about 4 secs on my PII-350. > > The Dirichlet method of solving isn't a better solution > because it has the same complexity. > > Could someone give me a hint on optimizing my algorithm or > if you got a better solution could you please forward it. > > Thankz. O(N) -> compute partial sums then find two with same remainder modulo N and subtract them i think you're proffessor becasuse you find algorithm that every one know.. i think you're proffessor becasuse you find algorithm that every one know.. Talking like you know everything Edited by author 28.05.2006 01:024s on p2-350 is enough for oj |