|
|
back to boardTo admins: Why WA#1?Help Please Posted by RASTA 22 Mar 2009 18:16 size of my archive is larger than text or something else? Help Please! Re: To admins: Why WA#1?Help Please Posted by RASTA 22 Mar 2009 19:26 my source: var s: ansistring; x: char; Begin while not eof do begin read(x); if x = #13 then s := s + '#'; if (x = #10) or (x = #13) then continue; s := s + x; end; x := chr(39); writeln('//CPP'); writeln('#include<iostream.h>'); writeln('int main()'); writeln('{char s[',length(s),']="', s, '";'); write('for(int i=0;i<',length(s),';i++)if(s[i]==',x,'#',x,')cout<<"\n";else cout<<s[i];return 0;}'); End. solution with stdio.h doesn't work too var s: ansistring; x: char; Begin while not eof do begin read(x); if x = #13 then s := s + '#'; if (x = #10) or (x = #13) then continue; s := s + x; end; x := chr(39); writeln('//CPP'); writeln('#include<stdio.h>'); writeln('int main()'); writeln('{char s[',length(s),']="', s, '";'); write('for(int i=0;i<',length(s),';i++)if(s[i]==',x,'#',x,')printf("\n");else printf("%s",s[i]);return 0;}'); End. Re: To admins: Why WA#1?Help Please size of my archive is larger than text or something else? Help Please! Yes Re: To admins: Why WA#1?Help Please Posted by RASTA 22 Mar 2009 22:38 I can't believe in it... in the first test more than 200 lines with characters #13 and #10... in my program only 130 additional symbols and more than 70 symbols I have in reserve Am I right? Edited by author 22.03.2009 22:46 Edited by author 22.03.2009 22:52 Re: To admins: Why WA#1?Help Please The size of your programm is the size of your output. Pay attention. Read clearly statement. Re: To admins: Why WA#1?Help Please Posted by RASTA 23 Mar 2009 00:14 I know this or I don't understand you... archive for test is //CPP #include<iostream.h> int main() {char s[!!!length of input!!!]="text from input with # instead of eofs"; for(int i=0;i<!!!length of input!!!;i++)if(s[i]=='#')cout<<"\n";else cout<<s[i];return 0;} so size of archive(output of my program) equal the size of input - count of eofs + integer from 130 to 140 it less than length of input where I'm wrong?may be statement in russian have some bugs? |
|
|