开发者

a short statement that consumes lots of CPU cycles

开发者 https://www.devze.com 2023-01-07 11:21 出处:网络
I\'m seeking a(very) short statement(in any language) that can make the CPU busy for like a second or a half. The statement should consume CPU cycles, not IO stuff开发者_如何学编程.Psuedocode:

I'm seeking a(very) short statement(in any language) that can make the CPU busy for like a second or a half. The statement should consume CPU cycles, not IO stuff开发者_如何学编程.


Psuedocode:

A = 2
StartTime = GetTime()
While (GetTime() - StartTime) < 1.0
  A = A * 2


Using java BigIntegers, you could try and implement http://en.wikipedia.org/wiki/Ackermann_function.

That'll keep you going for a while.

0

精彩评论

暂无评论...
验证码 换一张
取 消