|
|
Common BoardIN: 3 0 OUT: 0 This test helped me :D Good luck! What should I do, if some point O[i] has negative z-coordinate? Edited by author 11.10.2014 17:37 O[i] is one of given centers, isn't it? Nothing special. See the sample from statement. :) Garik test [1] 12 Oct 2014 15:51 from were i can get tests for problems or this is unavailable information? [RISE] Levon Oganesyan [RAU] Re: test 12 Oct 2014 16:06 No, Timus tests is unavailable. Maxim Buzdalov have added a new bunch of tests. Progbeat, showjim and [NRU ITMO] WiNGeR have lost their AC. Edited by author 07.10.2014 13:20 I think this problem is different with usual acm problems. for other problems writer give test cases to test code,this problem is reverse, using code to test the test cases. I think the final result is test cases AC all participant's codes, because it is NP hard problems.. Edited by author 12.10.2014 14:48 import java.util.Scanner; import java.util.Collections; import java.util.ArrayList; public class Timus{ public static void main(String[] args){
Scanner in = new Scanner(System.in); ArrayList<Integer> arr = new ArrayList<Integer>(); int n = in.nextInt(); for (int i = 0; i< n; ++i){ arr.add(in.nextInt()); } int b = in.nextInt(); for (int i = 0; i< b; ++i){ arr.add(in.nextInt()); } b = in.nextInt(); for (int i = 0; i< b; ++i){ arr.add(in.nextInt()); } int sum=0; int occurrences = 0; for(int j =0; j<n; ++j){ occurrences = Collections.frequency(arr, arr.get(j)); if (occurrences % 3 == 0){ sum = sum + occurrences; } }
System.out.print(sum/3);
} } Может ли Жаба пролететь в отверстие? Если да, можно ли бросать камешек уже когда жаба пролетела внутрь? "At any moment while the toad is in the air and its x coordinate is less than x coordinate of the wall outer surface Nod can throw a stone ..." 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; } Change 1000 to 1001 !!!! 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 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 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. Who knows when the contest problems will be avaible in the Archieve? Проблема была в скорости чтения данных. Почему так? У меня на компе работало 0.25 секунд на max тесте. LDV Soft TaskD 11 Oct 2014 14:30 Если 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 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 Find the solution and explanation of this task in manyprogrammingtutorials.blogspot.com 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;". What is test 3??? Help me!!! Please!!! 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 |
|
|