Acm (UVa) : 10790


How Many points of Intersection

Data Type:
long long

Trick:
SumA = Sum from 1 to a-1
SumB = Sum from 1 to b-1
Output: SumA * SumB

Advertisements

2 thoughts on “Acm (UVa) : 10790

  1. i take int a b and add 1 to a-1, 1 to b-1,
    then multiply a and b in unsigned long long res;
    but wa…….why???

  2. @nayem
    may be, your summation overflows the range
    make your SumA (1 to a-1) unsigned long long too

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