Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | what is the answer for 1 15 ? | MadPsyentist/Sam | 1117. Иерархия | 28 сен 2009 21:48 | 6 | agree blue dog 15 фев 2002 08:08 Edited by author 28.09.2009 21:55 | | why i am wrong???? | bill | 1008. Кодирование изображений | 28 сен 2009 20:31 | 1 | program p1008_image_encoding; const ele:array[1..4]of char=('R','T','L','B'); var b,v:array[0..11,0..11]of boolean; e,e1,xx,yy,h,num,swap,i,j,s,t:longint; x,y:array[1..10]of longint; a:array[0..11,1..2]of longint; ret,k:string; begin readln(ret); if pos(' ',ret)=0 then begin val(ret,num); readln(x[1],y[1]); b[x[1],y[1]]:=true; for i:=2 to num do begin readln(x[i],y[i]); b[x[i],y[i]]:=true; end; {for i:=1 to num-1 do for j:=i+1 to num do if (x[i]>x[j])or((x[i]=x[j])and(y[i]>y[j])) then begin swap:=x[i];x[i]:=x[j];x[j]:=swap; swap:=y[i];y[i]:=y[j];y[j]:=swap; end;} writeln(x[1],' ',y[1]); for i:=1 to num do if not v[x[i],y[i]] then begin v[x[i],y[i]]:=true; e:=1;e1:=1;h:=1; a[1,1]:=x[i];a[1,2]:=y[i]; while true do begin for j:=h to e do begin if (a[j,1]+1<=10)and(b[a[j,1]+1,a[j,2]])and(not v[a[j,1]+1,a[j,2]]) then begin inc(e1);a[e1,1]:=a[j,1]+1;a[e1,2]:=a[j,2]; v[a[j,1]+1,a[j,2]]:=true;write('R'); end; if (a[j,2]+1<=10)and(b[a[j,1],a[j,2]+1])and(not v[a[j,1],a[j,2]+1]) then begin inc(e1);a[e1,2]:=a[j,2]+1;a[e1,1]:=a[j,1]; v[a[j,1],a[j,2]+1]:=true;write('T'); end; if (a[j,1]-1>0)and(b[a[j,1]-1,a[j,2]])and(not v[a[j,1]-1,a[j,2]]) then begin inc(e1);a[e1,1]:=a[j,1]-1;a[e1,2]:=a[j,2]; v[a[j,1]-1,a[j,2]]:=true;write('L'); end; if (a[j,2]-1>0)and(b[a[j,1],a[j,2]-1])and(not v[a[j,1],a[j,2]-1]) then begin inc(e1);a[e1,1]:=a[j,1];a[e1,2]:=a[j,2]-1; v[a[j,1],a[j,2]-1]:=true;write('B'); end; if j<>num then writeln(',') else writeln('.'); end; if e1=e then break; h:=e+1;e:=e1; end; end; end else begin k:=copy(ret,1,pos(' ',ret)-1); val(k,s); delete(ret,1,pos(' ',ret)); val(ret,t); x[1]:=s;y[1]:=t; num:=1; xx:=x[1];yy:=y[1]; h:=1;e:=1;e1:=1; while ret<>'.' do begin for j:=h to e do begin readln(ret); for i:=1 to 4 do if pos(ele[i],ret)<>0 then begin inc(num); case i of 1:begin x[num]:=x[j]+1; y[num]:=y[j]; end; 2:begin x[num]:=x[j]; y[num]:=y[j]+1; end; 3:begin x[num]:=x[j]-1; y[num]:=y[j]; end; 4:begin x[num]:=x[j]; y[num]:=y[j]-1; end; end; end; end; h:=e+1;e:=num end; for i:=1 to num-1 do for j:=i+1 to num do if (x[i]>x[j])or((x[i]=x[j])and(y[i]>y[j])) then begin swap:=x[i];x[i]:=x[j];x[j]:=swap; swap:=y[i];y[i]:=y[j];y[j]:=swap; end; writeln(num); for i:=1 to num do writeln(x[i],' ',y[i]); end; end. please help me Edited by author 28.09.2009 20:32 | | Help for WA 1 | Oleg Strekalovsky [Vologda SPU] | 1094. Дисплей | 28 сен 2009 14:15 | 2 | Remember, that in input there are "end-of-line characters". And you must read string lines until your find "end-of-file characters". If Java while (in.hasNextLine()) { char input[] = in.nextLine().toCharArray(); /* analyse-code */ } This method (while(in.hasNext***()) often use, when you don't know the number of input data or you can find "end-of-line characters" in text line. Edited by author 30.04.2009 18:26 and..... "...Assume that at the beginning the e-screen contains 80 spaces..." (for TestCase#1) "...The width of the screen is 80 symbols. When the cursor reaches left or right edge of the screen it is automatically placed at the first position to the left...." (for TestCase#4) Don't miss that! Edited by author 28.09.2009 14:17 | | Java is so slow | Index Tree | 1100. Таблица результатов | 27 сен 2009 21:52 | 3 | Hi, I've solved this problem in C++ but when trying it in Java I can't avoid TL on test11. What should I do in order ot improve my IO operations. I use BufferedReader and PrintWriter. I can share my code if necessary you can call print only one time; and don`t use many concatenations StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); it will be enough. Good luck~ Hi, I've solved this problem in C++ but when trying it in Java I can't avoid TL on test11. What should I do in order ot improve my IO operations. I use BufferedReader and PrintWriter. I can share my code if necessary | | No subject | nick's_name | 1348. Пусти козла в огород 2 | 26 сен 2009 18:14 | 1 | Edited by author 26.09.2009 19:06 | | Вопрос для администрации | Aydar Bykeev | 1395. Pascal против C++. Версия 2 | 26 сен 2009 00:43 | 1 | | | WA4 | bilol | 1226. йынтарбО кодяроп | 25 сен 2009 20:27 | 1 | WA4 bilol 25 сен 2009 20:27 I can't find my mistake, if someone know suggest me my mistake please: #include <iostream> #include <string> #include <string.h> using namespace std; char* reverse(char* str) { char* temp = new char[strlen(str) + 1]; int i, n = strlen(str); if(str[n-1] == ',' || str[n-1] == '-' || str[n-1] == '.' || str[n-1] == '?' || str[n-1] == ':' || str[n-1] == ';') { temp[n-1] = str[n-1]; n-=1; } for(i = 0; i<n; i++) { temp[i] = str[n - i - 1]; } if(n == strlen(str) - 1) temp[i+1] = '\0'; else temp[i] = '\0'; return temp; } int main() { string *as = new string[1000]; int i = 0;
#ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif while(getline(cin,as[i++])) {
}
for(int j = 0; j<i-1; j++) { const char* str = as[j].c_str(); char* ch = new char[strlen(str) + 1]; strcpy(ch,str); //ch[strlen(str)] = '\0'; //cout<<ch; char* temp = strtok(ch," "); cout<<reverse(temp); while(temp != NULL) { temp = strtok(NULL," "); if(temp != NULL) cout<<" "<<reverse(temp); } cout<<endl; }
return 0; } | | Can anyone help me on this problem? I need some hints. | Megatron | 1592. Китайские часы | 25 сен 2009 18:28 | 1 | | | Problem 1058 "Chocolate". TL now is equal to 1 sec (+) | Sandro (USU) | 1058. Шоколад | 25 сен 2009 18:25 | 1 | Old TL was set according to slow testing computer. Now more than half of AC solutions work in 0.1 sec and faster. So we decided to decrease TL to 1 sec. 10 authors lost AC. | | at judge status site what does Test # mean? | 5thgfka | | 25 сен 2009 10:52 | 2 | | | WA31 | Alex Tolstov (Vologda STU) | 1505. Перекачка нефти | 25 сен 2009 01:05 | 2 | WA31 Alex Tolstov (Vologda STU) 16 сен 2009 13:15 Re: WA31 Alex Tolstov (Vologda STU) 25 сен 2009 01:05 What is fucking test 31?? Does anybody know? I use Dijkstra on residue network from several sources to sink. For every edge (u, v): 1) if flow < capacity then cost = 0 2) if flow > 0 then graph contains back edge (v, u) with cost = 0. Dijkstra initialize sources (nodes of the graph, where excess of flow > 0) with cost = 0. We find shortest path from one of sources to the sink. Then we make changes with edges used in shortest path and out results. What's wrong?? | | For anybody who wa | yzlhm | 1230. Интроспективная программа | 24 сен 2009 19:32 | 1 | 1.You can't use ';' at the end of the program 2.You can't use space in the pro except in " " or ' '! Hope it will be helpful for you! | | NO problen can be more interesting than it | yzlhm | 1230. Интроспективная программа | 24 сен 2009 19:28 | 1 | Though I spent lot of time on it ,but it give me so much fun that I could never forget it!!! | | Ambigous problem statement | gvsmirnov | 1008. Кодирование изображений | 24 сен 2009 05:01 | 1 | >At first, neighbors of the lowest left pixel are specified That is not true. The first pixel to be processed is the lowest among the leftmost ones, not vice verse. | | to Admins | Ibragim Atadjanov | 1249. Древний некрополь | 23 сен 2009 22:45 | 3 | to Admins Ibragim Atadjanov 23 сен 2009 10:27 My prog uses only private static byte[] mat;// max 3000 * 1 byte private static boolean ok;// 1 byte private static byte x, y; // 2 byte private static int n, m, i, j; // 4*4 byte=16 byte field variables its memory cant be 5 510 KB. total memory is 3019 B. I cant understand why i'm getting memory limit on test6 Try to read input strings this way: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ......... char[] input_str = new char[2 * m + 2]; ......... in.read(input_str, 0, 2 * m + 1); It help me to get AC with 0.296 sec. and 1662КБ. Good Luck! Edited by author 23.09.2009 17:08 Edited by author 23.09.2009 17:08 Thanks a lot. I got AC by your help | | My program crashed and I don't understand 64 bit thing. | Avijit Sarker | 1001. Обратный корень | 23 сен 2009 16:39 | 4 | Hello. The 1001 problem is the third problem I attempted in this site and I am new here. I am not familiar with 64-bit compiler system. The code written by me resulted in a crash, so I need some help. I wrote the code as follows: #include<stdio.h> #include<math.h> int main() { unsigned long long a[32768]; long i=0; while(scanf("%I64u",&a[i])==1) i++; for(i=i-1;i>=0;i--) printf("%.4lf\n", sqrt(a[i])); return 0; } I do know there are some fatal faults....but I really need help. Thanks. "A size of the input stream does not exceed 256 KB". You have got crash because quantity of numbers can be greater than 32768. Then how can I determine the quantity? If the stream consists of 1 byte characters, and the integers are assumed to be 4 bytes, I need 256*1024/4=65536 membered array, right? #include<stdio.h> #include<math.h> #include<stdlib.h> double d[200000]; int main(){ long long l; int i=0; while( scanf("%lld",&l) != EOF ) d[i++]=sqrt(l); for(i-=1;i>=0;i--) printf("%.4lf\n",d[i]); return 0; } Please help getting WA | | 1000 | inf14azad | 1000. A+B Problem | 23 сен 2009 04:36 | 5 | 1000 inf14azad 16 фев 2008 14:09 var a,b,c:integer; begin write('a,b='); read(a,b); c:=a+b; write('c=',c); end. Re: 1000 Alexander (201 - P TNU) 16 фев 2008 20:01 it's easy a little): var a,b,c:integer; begin read(a,b); c:=a+b; write(c); end. but it very little var a,b:integer; begin read(a,b); write(a+b); end. Re: 1000 Mihran Hovsepyan {2 kurs of <RAU>} 29 янв 2009 23:08 Edited by author 29.01.2009 23:08 help me please this is my code source i don't know why it's wrong #include<stdio.h> int main(void) { int a, b,c;
printf("Please enter a and b: "); scanf("%ld %ld", &a, &b);
c=a+b;
printf("a+b is %ld\n", c);
return 0; } | | WA9. Who can help me? | Programmer | 1527. Плохие дороги | 23 сен 2009 04:05 | 1 | What can be tricky test? Note: edge unidirectional(not undirectional). Edited by author 31.08.2010 01:23 | | GREAT PROBLEM | InShtein | 1033. Лабиринт | 23 сен 2009 03:31 | 2 | My program gets the right results on each test in discussion of the 1033 problem but I always get WA on test №1!!! My mind is broken... please whyyyy... What's the matter?! And the sample of problem is right too.... | | Is multiple solution possible? If yes which one is accepted by server? | Anupam Ghosh,Bengal Engg and Sc Uni,MtechIT,2006-09,India | 1007. Кодовые слова | 22 сен 2009 20:50 | 4 | somebody please help. In case of multiple solution which one to aouput? all my efforts for AC seems to go in vain. Any (but only one) symbol 0 is replaced by 1. Any (but only one) symbol is removed. A symbol (0 or 1) is inserted at any position. ......(but only one) is missing here in this statement Such use of indefinite article "A" implies "one". so, no, only one symbol is inserted. |
|
|