Common Board[edit] I used formula for day of week instead of pascal function. Got ac. I am using dayofweek to get the weekday for the first of the month in the question. I am getting WA7. I think my formatting is OK but I am getting wrong answers for some inputs. The two supplied examples are OK, and 20 10 2050 mon 3 10 17 24 31 tue 4 11 18 25 wed 5 12 19 26 thu 6 13 [20] 27 fri 7 14 21 28 sat 1 8 15 22 29 sun 2 9 16 23 30 and 25 11 1885 mon 2 9 16 23 30 tue 3 10 17 24 wed 4 11 18 [25] thu 5 12 19 26 fri 6 13 20 27 sat 7 14 21 28 sun 1 8 15 22 29 but not 4 7 1890 mon [ 4] 11 18 25 tue 5 12 19 26 wed 6 13 20 27 thu 7 14 21 28 fri 1 8 15 22 29 sat 2 9 16 23 30 sun 3 10 17 24 31 or 1 1 1600 mon [ 1] 8 15 22 29 tue 2 9 16 23 30 wed 3 10 17 24 31 thu 4 11 18 25 fri 5 12 19 26 sat 6 13 20 27 sun 7 14 21 28 from what I have seen in the forum. Any ideas please? Thanks Edited by author 05.12.2012 22:33 var a,b:integer; begin readln(a,b); writeln(a+b); end. probably you are wrong this is so hard problem :) !!! var a,b:longint; begin read(a,b); writeln(a+b); end. (Try this,not readln,but read) :) Edited by author 12.04.2010 16:14 "highly protable"? May be "highly profitable"? And "in those aairs"? May be "in those affairs"? Edited by author 05.12.2012 10:26 Firstly i calculate the longest rope lenths at each tree. Then just try to tether goats to every tree, calculating the square. If sum of 2 maxrope are larger then lenght between trees: double maxrad = std::max(maxr[i], maxr[j]); double minrad = l - maxrad; if (minrad < 1.0) { maxrad = maxrad - (1 - minrad); minrad = 1.0; } if (maxrad >= 1.0) maxsize = std::max(maxsize, square(maxrad)+sqree(minrad)); Try this test 4 0 0 5 0 6 0 6.5 0 Right answer is 53.4071 Thx, really nice test. Now AC :) Yeah... I was caught by that too :)) Help me!, I got WA 5!. :-s stuck in WA5 too>"< can't understand Give me some tests Edited by author 13.01.2013 05:15 I solved using too mush time Can anyone explain me how some people did it in 0.031?? Please) This problem can be solved via sorting by angle in this time)) C++, 0.015 sec, 196 Kb #include <iostream> using namespace std; int main() { int n,k; cin>>n>>k; int m=n/k + ((n%k==0) ? 0:1); int * A=new int [m*k]; for (int i=0;i<n;i++) { cin>>A[i]; } for (int i=n;i<m*k;i++) A[i]=-1; for (int i=0;i<m;i++) { for (int j=0;j<k;j++) { int h=j*m+i; if (A[h]<0) cout<<" "; if (A[h]>-1 && A[h]<10) cout<<" "<<A[h]; if (A[h]>9 && A[h]<100) cout<<" "<<A[h]; if (A[h]>99 && A[h]<1000) cout<<" "<<A[h]; } cout<<endl; } return 0; } Waiting of comments C, 0.015 sec, 112 kb main() { short n,k,a[101],i,j; scanf("%d %d",&n,&k); k=(n+k-1)/k; for(i=0;i<n;i++)scanf("%i",&a[i]); for(j=0;j<k;puts(""),j++) for(i=j;i<n;i+=k) printf("%4d",a[i]); } What's incorrect????? int main() { int n, k; scanf("%d %d", &n, &k); vector<int> mas(100);
mas.assign(100, -1); for (int i=0; i<n; i++) scanf("%d", &mas[i]); int s=n/k; if(n%k!=0) s++; for (int i=0; i<s; i++) { for(int j=0; j<k; j++) if (mas[s*j+i]!=-1) printf("%4d", mas[s*j+i]); printf("\n"); } return 0; } Edited by author 26.04.2011 20:30 vector<int>mas; mas.assign(111,-1); 100 1 1 2 3 4 .. 99 100 ans: 1 2 3 4 .. 99 100 Edited by author 09.07.2011 17:54 My AC code : ans: 1 2 3 4 . . . 99 100 i think there must be some stupid mistake.My all tests pass it. please provide me good tests or please,kindly let me know the problem in the code: [code deleted] AC at last(.187 sec 121 kb) very very stupid mistake. if(x==n-x) just print x not x and n-x :P Edited by author 12.07.2010 10:41 Edited by author 13.07.2010 18:43 if(x==n-x) It's possible only if n==2 is it possible to happen x == n-x ??? if yes, then 2*x = n; but n is prime and is not divisible by 2. Can someone give me some tests? I have WA#10, I don't know what else I can fix to solve this problem. I used hashes, but I think that my simple algorithm can have collisions, because I make hash mod 10000000; //sorry for my english. also I changed algorithm, now I don't use mod. But, I still have WA#10. I used stack + hash, but, all the same Edited by author 03.12.2012 19:10 Edited by author 03.12.2012 19:34 Where's my mistake? #include <iostream> #include <cmath> using namespace std; int main() { double n, s; cin >> n; s = (1 + n) * (abs(n / 2.) + (n < 1)); cout << s; return 0; } Is it necessary to make a complete graph. Is it possible to find the solution in a more easy way? I always get stuck on #4. Just simple BFS. Now i am stuck on problem 1. What is the output here? My program has the output of the example. Has something changed? Edited by author 03.12.2012 04:30 Task:Сумма #include <iostream> #include <cmath> using namespace std;
int main() { double n, s; cin >> n; s = (1 + n) * (abs(n / 2.) + (n < 1)); cout << s; return 0; } what is test 3? у меня на 3 вылетало примерно из-за такого теста 20 1 0 0 -1 -1 -1 -1 Edited by author 23.10.2012 16:38 1 20 1 20 у меня он его верно проходит ) там,что другое должно быть у меня на 3 вылетало примерно из-за такого теста 20 1 0 0 -1 -1 -1 -1 Edited by author 23.10.2012 16:38 I want to know how can you know the test? > I want to know how can you know the test? If you fail a test, then fix a particular part of the logic of your program, then pass that test, you then know what condition is covered by that particular test. I find it very strange when in QuickSort : pivot = A[(High+Low) div 2]; will get me AC for both tests while pivot = (High+Low) div 2; .... A[pivot] will give me WA4/WA6 . Try to sort this array (it's too big, but i'm so lazy and don't want to discover another example) with second version of your qSort: 16 4 2 3 2 2 1 2 10 6 3 2 2 11 128 0 2 What you got? :) Edited by author 30.07.2012 21:12 pp := arr[(ll + rr) div 2].val; while (ii <= jj) do begin while (arr[ii].val < pp) do Inc(ii); while (arr[jj].val > pp) do Dec(jj); if (ii <= jj) then begin t := arr[ii]; arr[ii] := arr[jj]; arr[jj] := t; Inc(ii); Dec(jj); end; end; This is right. but not this pp := (ll + rr) div 2; while (ii <= jj) do begin while (arr[ii].val < arr[pp].val) do Inc(ii); while (arr[jj].val > arr[pp].val) do Dec(jj); if (ii <= jj) then begin t := arr[ii]; arr[ii] := arr[jj]; arr[jj] := t; Inc(ii); Dec(jj); end; end; because in the loop, the if statement will possibly change the value of arr[pp].val. That is why you have WA6. I have tried double but it does not work can anybody tell me why ??? Прошу выложить работающее решение на Паскале. Все еще не могу найти у себя ошибку. Спасибо Выложи прогу на паскале, мы попробуем найти ошибку. program Biatlon; {$APPTYPE CONSOLE} uses SysUtils; var n,i,j,t,x,z,q1,q2,q3,a,g1,g2,g3,o: integer; x1,x2: string; s: array[1..100] of string; r: array[1..100] of string; viv: array[1..100] of string; procedure swap(var x8,y: string); var t4: string; begin t4 := x8; x8 := y; y := t4; end; begin g1:=32000; g2:=61; g3:=32000; o:=0; readln(n); for i:= 1 to n do readln(s[i]); for i:= 1 to n do begin t:=Pos(' ',s[i]); x:=length(s[i]); r[i]:=Copy(s[i], t+1, 7); delete(s[i],t,8); z:=pos(':',s[i]); x1:=copy(r[i],z+1,2); x2:=copy(r[i],z+4,4); val(x1,q1,j); val(x2,q2,j); q3:=q1*60+q2; if q3<g3 then begin g3:=q3; o:=o+1; viv[o]:=s[i]; end; end; for j:=1 to o-1 do begin for i:=1 to o-j do begin if viv[i] > viv[i+1] then swap(viv[i],viv[i+1]) end; end; writeln(o); for i:=1 to o do if i=o then write(viv[i]) else writeln(viv[i]); readln; end. Вот вам решение. 1-ый тест обязано проходить. Но почему-то не проходит. Edited by author 01.12.2012 22:49 |
|