Forum: "Main";

Current archive: 2002.01.08;

Download: [xml.tar.bz2];

Down## New problem: + ( Find similar branches

←→

stalin (2001-12-18 00:20) [0]As knowing how many digits in a number are in a mathematical way to unfold a number (that is, it was 135, 531 should be obtained) ....... Here! ; +)

←→

Blackweber (2001-12-18 00:28) [1]It is possible to start a cycle from 1 to length (num), in which the first digit is read and put at the end of the number.

←→

Blackweber (2001-12-18 00:34) [2]those. 135> 351> 513

←→

False_Delirium (2001-12-18 01:02) [3]Function Reverse (Z: Integer): Integer;

var T: Integer;

begin

Result: = 0;

T: = Trunc (Ln (Z) / Ln (10));

while Z> 0 do

begin

Inc (Result, (Z mod 10) * Round (Exp ((T) * Ln (10))));

Z: = Z div 10;

Dec (T);

end

end;

←→

Sergey_n (2001-12-18 01:37) [4]I can offer a variant in C ++

int x = 27531; // which should be deployed

int y = 0; // where to deploy

int n = (int) log10 (x); // the length of the number to be expanded

for (int i = n; i> = 0; i -) {

y=y+((int)(x/pow(10,i))-10*(int)(x/pow(10,i+1)))*(int)pow(10,n-i);

}

←→

False_Delirium (2001-12-18 02:05) [5]> Sergey_n You have 14 operations for the interration..and I have 10 ... :) .. heh ..:)) ..:))) ... who is less ..?. :)))

←→

Sergey_n (2001-12-18 03:16) [6]The question was posed to write, and not who is less. In this case, the task is completed. By the way how do you think (iteration) ????

←→

False_Delirium (2001-12-18 04:14) [7]Why did you then write if the task was already completed when the first example was written .. ?? The number of iterations is the number of repetitions of the cycle, and the number of operations is the number of arithmetic operations per iteration.

←→

Sergey_n (2001-12-18 22:59) [8]2False_Delirium when I started writing it was not yet completed.

> The number of iterations is the number of repetitions of the cycle, and the number

> operations is the number of arithmetic operations per iteration.

it's a no brainer. Are you sure that in the interior of Fu-i Inc, Round, ... arithmetic operations as much as you think ?????

←→

False_Delirium (2001-12-19 00:10) [9]Heh ..:) ... but I'm sure in Inc, but Round is validly executed in 3 operations, you can remove it altogether ..... but what do you say about pow ...:) ...? ... :)

←→

KilkennyCat (2001-12-19 02:27) [10]but this is not a mathematical way.

←→

Sergey_n (2001-12-19 04:41) [11]2False_Delirium I was not lazy and tested using a trace. prog

Label1-> Caption = DateTimeToStr (Now ());

double x = 20, y;

for (register __int16 i = 0; i <2767; i ++)

for (register __int16 j = 0; j <32767; j ++)

<test expression>;

Label2-> Caption = DateTimeToStr (Now ());

and here is the result:

expression | runtime (for my computer)

-----------------------------------------------------------

pow (10, x) | 19 sec

exp (x) | 28 sec

ln (x) | 25 sec

-----------------------------------------------------------

total exp + ln = 53 sec, pow + pow + pow = 57 sec

but if you add Inc, Round, Dec, .... to exp + ln

then you can still argue who is faster.

←→

False_Delirium (2001-12-19 05:16) [12]Write in Pascal to start and then compare .. :)) ... to test ...

otherwise you need to consider two languages in the context of execution speed .. :) ..

Yes ... so you test immediately the function of "coup" ....

←→

False_Delirium (2001-12-19 05:32) [13]> KilkennyCat And what is this method .. ??.:) ... exactly mathematical, no other operations were used ..

←→

False_Delirium (2001-12-19 05:37) [14]Yes, by the way ... DateTimeToStr (Now ()) is a slightly unsuitable function for such tests .. :)) ..

←→

Sergey_n (2001-12-19 06:10) [15]2False_Delirium Delphi is too lazy to bet, but why do not you like DateTimeToStr (Now ())? If you are on accuracy, then increase the cycle (or their number) to last longer.

←→

KilkennyCat (2001-12-20 01:33) [16]> False_Delirium Do maths have cycles? :)

Pages:1whole branch

Forum: "Main";

Current archive: 2002.01.08;

Download: [xml.tar.bz2];

Memory: 0.6 MB

Time: 0.038 c

4:22483

Stropal

2001-11-03 10:57

2002.01.08

Fukntion parameters

1:22116

Bond

2001-12-19 19:08

2002.01.08

Does anyone have a thread hash MD5?

1:22039

Yuri btr

2001-12-18 10:46

2002.01.08

Form

1:22050

Russian

2001-12-18 17:03

2002.01.08

WELL VERY INTERESTING QUESTION :))))

1:22044

Eduard

2001-12-10 10:09

2002.01.08

Frame

Stropal

2001-11-03 10:57

2002.01.08

Fukntion parameters

1:22116

Bond

2001-12-19 19:08

2002.01.08

Does anyone have a thread hash MD5?

1:22039

Yuri btr

2001-12-18 10:46

2002.01.08

Form

1:22050

Russian

2001-12-18 17:03

2002.01.08

WELL VERY INTERESTING QUESTION :))))

1:22044

Eduard

2001-12-10 10:09

2002.01.08

Frame