In the sum shown above each letter represents a digit. Let be the maximum value for , be the minimum value for and be all possible sums of
Find .
Note: You can create a program(in any language) to find the above value , but the program should not contain any predefined functions or procedures. That is you must create all functions and procedures and they should appear in the program, and not called from a library you created. For example, you could create your own maximum and minimum function for an array of integers and your own power function.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I used Free Pascal to write the code below.
program for_brillant2;
type arraytype = array[1 .. 300] of longint;
var myfile:text; {Not necessary. Just adding a file to list all possible sums.}
function lintpower(base,exponent:longint):longint;
var n,product:longint;
begin
for n:= 1 to exponent do
begin
end;
end;
function minnum(a:arraytype; last:longint):longint;
var j,n:longint;
begin
end;
function maxnum(a:arraytype; last:longint):longint;
var j,n:longint;
begin
end;
procedure getlist2;
var o,n,e,m,t,r,i,answer,a1,a2,a,b,total,j:longint;
begin
assign(myfile,'brillant2.txt');
rewrite(myfile);
bool:= false;
j:= 1;
for o:= 1 to 9 do
begin
for n:= 0 to 9 do
begin
for e:= 0 to 9 do
begin
for m:= 1 to 9 do
begin
for t:= 1 to 9 do
begin
for r:= 0 to 9 do
begin
for i:= 0 to 9 do
begin
if (o <> n) and (o <> e) and (o <> m) and (o <> t) and (o <> r) and (o <> i)
and (n <> e) and (n <> m) and (n <> t) and (n <> r)
and (n <> i) and (e <> m) and (e <> t) and (e <> r)
and (e <> i) and (m <> t) and (m <> r) and (m <> i)
and (t <> r) and (t <> i) and (r <> i)
then
begin
end;
end;
end;
end;
end;
end;
end;
end;
close(myfile);
end;
begin
getlist2;
readln;
end.
Running the program above we obtain:
a = 9 4 8 0 , b = 2 3 1 0 , n = 4 2 ⟹ a − b + n = 7 2 1 2 .
Although it's not necessary to this problem, the list of all possible sums are:
540 + 2580 = 3120
560 + 3570 = 4130
570 + 3560 = 4130
580 + 2540 = 3120
610 + 4630 = 5240
610 + 8670 = 9280
630 + 4610 = 5240
630 + 7640 = 8270
630 + 8650 = 9280
640 + 1670 = 2310
640 + 7630 = 8270
650 + 8630 = 9280
670 + 1640 = 2310
670 + 8610 = 9280
720 + 5730 = 6450
720 + 8760 = 9480
730 + 1780 = 2510
730 + 5720 = 6450
730 + 8750 = 9480
740 + 2780 = 3520
750 + 8730 = 9480
760 + 8720 = 9480
780 + 1730 = 2510
780 + 2740 = 3520
810 + 3820 = 4630
810 + 4830 = 5640
820 + 3810 = 4630
830 + 4810 = 5640
850 + 1860 = 2710
860 + 1850 = 2710
910 + 3920 = 4830
910 + 4930 = 5840
910 + 5940 = 6850
910 + 6950 = 7860
920 + 3910 = 4830
920 + 5930 = 6850
920 + 6940 = 7860
930 + 4910 = 5840
930 + 5920 = 6850
940 + 5910 = 6850
940 + 6920 = 7860
950 + 6910 = 7860