UVA 11401 Triangle Counting(数学)

2014-11-24 11:05:33 · 作者: · 浏览: 0

Problem GTriangle Counting

Input: StandardInput

Output: StandardOutput

You are given n rods oflength 1, 2…, n. You have to pick any 3 of them & build a triangle. Howmany distinct triangles can you make Note that, two triangles will beconsidered different if they have at least 1 pair of arms with differentlength.

\

Input

The input for each case will have only a single positive integern < http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vc3Ryb25nPigzPD1uPD0xMDAwMDAwKS4gVGhlIGVuZCBvZmlucHV0IHdpbGwgYmUgaW5kaWNhdGVkIGJ5IGEgY2FzZSB3aXRoPHN0cm9uZz5uPC9zdHJvbmc+PDMuVGhpcyBjYXNlIHNob3VsZCBub3QgYmUgcHJvY2Vzc2VkLjwvcD4KPHA+PHN0cm9uZz5PdXRwdXQ8L3N0cm9uZz48L3A+CjxwPkZvciBlYWNoIHRlc3QgY2FzZSwgcHJpbnQgdGhlIG51bWJlciBvZiBkaXN0aW5jdCB0cmlhbmdsZXMgeW91IGNhbm1ha2UuPC9wPgo8cD48c3Ryb25nPlNhbXBsZSBJbnB1dCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPdXRwdXQgZm9yIFNhbXBsZSBJbnB1dDwvc3Ryb25nPjwvcD4KPHRhYmxlIGJvcmRlcj0="1" cellspacing="0" cellpadding="0">

5

8

0

3

22

Problemsetter: Mohammad Mahmudur Rahman


每次做这种三角形的题的时候,我就想到了三角恋,然后就有一种想挖别人墙角的感觉,世界观啊,情商啊,更年期啊。。。看电视剧的时候也是一样,总是支持反派,这情况好像不太正常。。。。(飙泪中。。。)


代码:

#include 
    
     
#include 
     
       #include 
      
        #include 
       
         #define MAXN 1000000+10 using namespace std; typedef unsigned long long ULL; ULL a[MAXN]; int main() { a[3] = 0; for(ULL i=4; i
        
         代码有点短是吧,没办法啦,水平有限+更年期,真是不容易啊。。。