Zung04052000's blog

By Zung04052000, history, 11 years ago, In English

{$MODE OBJFPC}

{$COPERATORS ON}

uses math;

const

{$IFDEF ONLINE_JUDGE}

{$R-,Q-,S-,I-}

{$OPTIMIZATION LEVEL2}

{$INLINE ON}

Fi      = '';           
    Fo      = '';

{$ELSE}

{$INLINE OFF}

Fi      = 'GCDLCM.inp'; // this is the file you use when judging in your computer
    Fo      = 'GCDLCM.Out';

{$ENDIF}

begin

assign(input, fi); reset(input);

assign(output,fo); rewrite(output);

end.


I get tired of forgetting to delete or turn off the open and the close file before submitting to Codeforces or anywhere else and the result is I sometime get 'compiler error', so this is what I do to make sure that won't happen again. Although it looks kinda complicated and long too but it is really useful for me when testing a large input (like some graph problems) and I don't have to hide or change the input and output files anymore.


{__for someone don't know__}

The {$coperators on} there is used for some 'arithmetic expression' like :

a:=1; a+=1; // a=2

a:=3; a*=3; // a=9

a:=3; a-=1; // a=2

... I think it types faster than use a:=a+?; (if the variable is long)

{____}


If you have another way to do, you can share with everyone bellow =)), hope you find this post something useful !

Also, this code wasn't me, it's from my teacher, his nick is 'lmhoang' and he allowed me to post this.

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it