题目: |
program test_2012_1;
var x,a,b,c,d,z:integer;
begin
readln(x);
a:=x mod 10;
b:=(x mod 100) div 10;
c:=(x mod 1000) div 100;
d:=x div 1000;
z:=a*a+b*b+c*c+d*d;
if trunc((c*d)/(a*b))=(c*d)/(a*b) then inc(z,a*b) else inc(z,c*d);
writeln(z);
end.
输入:1234 输出:32
|