程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> UVA 11401 Triangle Counting(數學)

UVA 11401 Triangle Counting(數學)

編輯:C++入門知識

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.Bkjia.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代碼有點短是吧,沒辦法啦,水平有限+更年期,真是不容易啊。。。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved