ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1095. Nikifor 3

help me to find the mistake in my program
Posted by Brenda 12 Nov 2002 20:36
program xt;

  const use                     :array[0..6] of integer
                                =(3241,1324,1234,2341,1243,1342,2134);
  var a,p                                       :extended;
      n,i,pp,t,k,po                             :integer;
      j                                         :char;
      s                                         :string;

  begin
    readln(n);
    for i:=1 to n do
      begin
        readln(s);
        for j:='1' to '4' do
          begin
            po:=pos(j,s);
            delete(s,po,1);
          end;
        a:=0; t:=0;
        for k:=1 to length(s) do
          if s[k]<>'0' then a:=a*10+(ord(s[k])-48)
                       else inc(t);
        if a<>0 then write(a:0:0);
        p:=a-7*int(a/7);
        pp:=trunc(p);
        write(use[pp]);
        for k:=1 to t do write('0');
        writeln;
      end;
  end.