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 1189. Pairs of Integers

How can i do faster?
Posted by Yashar Abbasov 22 Nov 2007 14:39
I submitted several times but got TL#4.
Where is my fault?

var
 r,p,m,n,i:longint;
 kod:integer;
 j:shortint;
 q,s,t:string[10];
 st:array [1..1000000] of string[50];

begin
 readln(n); str(n,q); r:=1;
 for i:=1 to length(q)-1 do r:=r*10; i:=n-r;
 repeat
  inc(i); str(i,s); j:=0;
  repeat
   inc(j); t:=s; delete(t,j,1); val(t,m,kod);
   if m+i=n then
    begin
     inc(p); st[p]:=s+' '+'+'+' '+t+' '+'='+' '+q; break;
    end;
  until j=length(s);
 until i=n;
 writeln(p); for i:=1 to p do writeln(st[i]);
end.

What's the min value of the first number. I mean it's min value according to N

Edited by author 22.11.2007 14:40
Re: How can i do faster?
Posted by Piratek-(akaDK) 16 Aug 2008 01:00
Simple Problem. Just solve it. Go from last digits to first.