ACM (UVa) : 10700


Camel Trading

Data type:
Long Long Integer / Double

Trick:

Maximum value: First calculate all Addition then Multiplication.

Minimum value: First calculate all Multiplication then Addition.

Critical input:
9+8*20*20+20*20
20*20*20*20*20*20+1
15+2+8+6+4+19+20+1
15*2*8*6*4*19*20*1

Critical output:
The maximum and minimum are 272000 and 3609.
The maximum and minimum are 67200000 and 64000001.
The maximum and minimum are 75 and 75.

The maximum and minimum are 2188800 and 2188800.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s