Show all threads Hide all threads Show all messages Hide all messages |
Overrated | andreyDagger | 1094. E-screen | 18 Dec 2021 13:32 | 1 |
Damn, how is this problem 440 difficulty, I solved it in 10 minutes |
Why my program wrong in 4 test? give some tests!!! help plz (s menya pivo) | Tolstobrov_Anatoliy[Ivanovo SPU] | 1094. E-screen | 4 Aug 2018 10:08 | 7 |
var s:string; m:array[-50000..50000]of char; i,min,max,u:longint; begin readln(s); u:=0;min:=90001;max:=-90001; for i:=1 to length(s) do begin if s[i]='<' then dec(u); if u<1 then u:=1; if s[i]='>' then inc(u); if (s[i]<>'>')and(s[i]<>'<') then begin m[u]:=s[i]; if min>u then min:=u; if max<u then max:=u; inc(u); end; end; for i:=min to max do write(m[i]); end. The length of the screen is 80 symbols! man give test plz. With my mistake! Here is a piece of code: ........................................... s, res: string; p, i: integer; readln(s); res:= ''; for i:=1 to 80 do res:= res+' '; p:= 1; for i:=1 to length(s) do begin if s[i]='<' then begin dec(p); if p<1 then p:=1; end else if s[i]='>' then begin inc(p); if p>80 then p:=1; end else begin res[p]:= s[i]; inc(p); if p>80 then p:=1; end; end; write(res); ............................................... Something like that will give U AC. I'm not sure, but I think it is because signs are "(:;-!?.,)" 1) Use a line long 80 2) Read out symbols In my case, the problem was that after writing char out I didn't wrap the cursor back to the beginning. |
Runtiime Error on submission. Can't replicate error on my computer. | James Gregory | 1094. E-screen | 17 Oct 2017 00:19 | 1 |
SOLVED Edited by author 17.10.2017 00:37 |
КАК читать пробелы в C++ | And IV | 1094. E-screen | 23 Mar 2015 21:18 | 5 |
int a = getc(stdin); read by simbol Before reading of spaces you must read rules of webboard! Speak in English! char ch; while(cin.get(ch)) { } можно вводить строку с пробелами целиком для string s; getline(cin, s); можно вводить символ char ch; ch = getchar(); эта штука позволяет вводить не только пробелы, но и символы перевода строк и прочее. в основном, пользуюсь этими двумя способами. |
Can I use "gets(str)"? | Mickkie | 1094. E-screen | 1 May 2014 04:48 | 2 |
Because the input info states that "The single line of the input contains a sequence" ... The "Single" line but I got #1WA here's my code: #include<stdio.h> char str[10005],output[85],temp; int i,ptr; main() { /* while (scanf("%c",&temp)!=EOF) { if (temp >= 32) str[i++]=temp; } */ gets(str);
for (i=0;str[i];i++) { if (str[i]=='>') { if (output[ptr]!=0) { ptr++; if (ptr==80) ptr=0; } } else if (str[i]=='<') { if (ptr>0) ptr--; }
else { output[ptr]=str[i]; ptr++;
if (ptr==80) ptr=0; }
} printf("%s",output); scanf(" "); } Where is my mistake? Thanks :) ты строчку длины 85 выводишь |
help for wa 9 | fredAC | 1094. E-screen | 12 Nov 2012 19:39 | 3 |
wrong on the following code /////////////////////// if(pos >maxline -1) pos = 0; a[pos++] = char; //////////////////// when test case: aaaaaaaaaaa.......a(total 80 a)<b b should in pos 1 instead of erasing pos 80
Yeah, my program's output is exactly "baaaaaaaaaa....a". But I still got WA#9. if(pos >maxline -1) pos = 0; a[pos++] = char; if (pos>maxline-1) pos=0; // may be this help for you Edited by author 12.11.2012 19:43 |
WA#1 - ok from text file but not ok on server -Windows | Berbinschi Tudor | 1094. E-screen | 21 Mar 2012 22:45 | 1 |
[code][/code] Accepted.I want know the AC solution that has 0.001 time Edited by author 21.03.2012 22:51 |
WA #1 :: Windows end-of-line | [MAI] iLoveDiscreteAnalysis | 1094. E-screen | 11 Mar 2012 12:54 | 1 |
If you read input char-by-char, you should skip "\r" too, not only "\n". |
for wa#1 | vahan | 1094. E-screen | 23 Jul 2011 03:39 | 2 |
and what about remaining spaces ? |
WA on test4 | EH | 1094. E-screen | 27 Sep 2010 14:38 | 1 |
|
Strange problem! (for those who has wa 1) | Slam [Tartu U] | 1094. E-screen | 12 Aug 2010 11:33 | 3 |
1) For those who get WA 1 mb helps : with while (!cin.eof()) char c = cin.get(); i had WA 1 with char t[10000]; cin.getline(t, 1000); i had WA 9 ! 2) the problem says that the length of input is no more than 10000 characters but this code ... char t[10000]; cin.getline(t, 10000) ... get WA9 this : char t[20000]; cin.getline(t, 20000); get AC Strange, isn't it? Yes,It's very strange! ----------- char t[10001]; cin.getline(t,10000,'\n'); ---------- I got WA9. ----------- char t[10001]; cin.getline(t,10001,'\n'); ---------- I got AC! 1. Maybe you didn't add a '\0' at the end of string when reading by chars. 2. For maxlen=10000, array must be at least as big as 10001! |
ADMINS!WHY WA#1??? | 123 | 1094. E-screen | 31 May 2010 20:05 | 4 |
#include<stdio.h> #include<iostream> using namespace std; char s[10001],str[80]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif int j = 0; memset(s,'\0',sizeof(s)); while(gets(s)) { int len = strlen(s); int i = 0; while(i<len) { if(s[i]=='>') { j++; if(j>79)j=0; } else if(s[i]=='<') { j--; if(j<=0)j=0; } else if(s[i]!='\n' && s[i]!='\0') { str[j] = s[i]; j++; } i++; } memset(s,'\0',sizeof(s)); } for(int i = 0;i<80;i++) printf("%c",str[i]); return 0; } "at the beginning the e-screen contains 80 spaces" I add in begin memset(str,' ',sizeof(80)); I get WA#1 to former =( Thank you!!!You help me!!!I got AC!!!=) |
Why I WA for the text one?But i have passed the example text? | zslwyuan | 1094. E-screen | 31 Dec 2009 10:44 | 2 |
var s:array[1..100010] of char; i,j,k,l,now,lo:longint; a,t1,t2:string; begin a:=''; for i:=1 to 80 do a:=a+' '; i:=0; while not(eof) do begin inc(i);read(s[i]); end; lo:=i; now:=1; for i:=1 to lo do begin if (s[i]='<') then begin dec(now); if (now=0) then now:=1; continue; end; if (s[i]='>') then begin inc(now); if (now=81) then now:=1; continue; end; if now=1 then t1:='' else t1:=copy(a,1,now-1); if now=80 then t2:='' else t2:=copy(a,now+1,80-now-1); a:=''; a:=t1+s[i]+t2; t1:=''; t2:=''; inc(now); if (now=81)then now:=1; end; for i:=1 to 80 do write(a[i]); end. |
Help for WA 1 | Oleg Strekalovsky [Vologda SPU] | 1094. E-screen | 28 Sep 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 |
Tips if you get WA or Crash | Stjepan Glavina | 1094. E-screen | 11 Nov 2008 15:33 | 3 |
Here are a few typical mistakes: a) you forgot to fill the array with ' ' b) you're doing gets( buff ), and the size of buff is less than 10000 c) you're doing printf( "%s", out ), and you forgot to do out[80] = '\0' d) if the position becomes 80, you go to 79 instead of 0 e) you don't print trailing spaces Good luck! faint! I didn't see the word 'mistakes' ...... d) seems to be wrong, "When the cursor reaches left or right edge of the screen it is automatically placed at the first position to the left." so if the position becomes 80, you should go to 0. |
I got an AC! | Grigory 'Stargazer' Javadyan [RAU] | 1094. E-screen | 19 Oct 2008 16:02 | 1 |
I got an AC! Grigory 'Stargazer' Javadyan [RAU] 19 Oct 2008 16:02 A very easy problem. Just read teh description carefully, there are some traps inside. |
For Everybody Who Had WA!! like ME | Nujarin | 1094. E-screen | 16 Oct 2008 00:17 | 3 |
1.I Just gets(str)NOT while(!feof(stdin))scanf("%c",&choice); 2.I Clear all member in output array = ' '; 3.I print With for(i = 0;i < 80;i++)printf("%c",data[i]) NOT printf("%s",data); 4.I print output with 80 len of Symbols NOW I GET AC!!! Thanks a lot. Using "gets" solved my problem with WA#1. It's interesting, why has it occured? it's very simple. there is '\n' at the end of input line )) gets delete it for you but you forgot about this when you read input byte after byte. |
i think i misunder stand this problem!! | Bobur | 1094. E-screen | 20 Feb 2008 22:57 | 1 |
in example writen--- "Look for second hamburger at computer and chairs.790 " there mustn't writen "790". number of "<" is bigger than answer. and why "790" in the end of sentence!! pls, explain it to me!!! thx!!! and i think it is right!! program Project1094; {$APPTYPE CONSOLE} uses SysUtils; var a : string[80]; i, j : integer; ch : char; f, f1 : textfile; begin assign(f, '1094.in'); assign(f1, '1094.out'); reset(f); rewrite(f1); i := 0; fillchar(a, sizeOf(a), 0); while not eof do begin read(ch); if ch = '>' then begin if i < 80 then begin inc(i); a[i] := ' '; end else i := 0; end; if (ch = '<') and (i > 0) then dec(i); if (ch <> '<') and (ch <> '>') then begin inc(i); a[i] := ch; end; end; for j := 1 to i do write(a[j]); close(f); close(f1); end. Edited by author 20.02.2008 23:05 |
Please help.I don't understand the task.Thank!!! | CHIDEMYAN SERGEY | 1094. E-screen | 9 Feb 2008 02:01 | 1 |
I don't understand task.Please write me explanation on serchch@mail.ru(on russian),if you can.Thank you very much!!! |
Writing!? | Pier Paolo Guillen Hernandez | 1094. E-screen | 17 Dec 2007 16:13 | 4 |
Writing!? Pier Paolo Guillen Hernandez 21 Jan 2003 23:55 Should I always print 80 chars or not? Thanks! Yes. Initialize a char array of 80 with spaces, make changes then print all of it. |