第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

一道acm的題,看了半天,不理解題意,求解釋~

一道acm的題,看了半天,不理解題意,求解釋~

慕尼黑5688855 2018-12-07 10:50:54
Problem DescriptionAs a student in computer science, Ant is weak in Graph Theory learning. One day, he comes across a problem. Given a non-directed graph G which is donated by G = {V, E}. V is the set of vertexes and E is the set of undirected edges. You should select some vertexes as key vertexes and each edge should be connected by at least one key vertex. Ant sometimes can select the key vertexes as described above. But now he wants to select least vertexes as key vertexes. Here comes your question, given a graph and tell Ant how many ways are there to select least key vertexes. InputThe first line of the input contains an integer T which is the number of test case, and then there are T groups of data following. For each group of data, the first line contains two integers. The first integer n is the number of vertexes and the second integer m is the number of edges. The next following m lines describe the edges. Each line contains two integers u, v which indicates there is an undirected edge connected vertex u and vertex v. (0 < n ≤ 20, 0 < m ≤ 300, u ≠ v, 1 ≤ u, v ≤ n) OutputFor each test case, output an integer which is the number of ways that selecting least key vertexes. Sample Input14 31 22 33 4 Sample Output3 Hint For the sample, there are three ways, which are selecting {1, 3}, {2, 4}, {2, 3}
查看完整描述

2 回答

?
一只名叫tom的貓

TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超3個(gè)贊

不知道你是不懂英文還是不懂題目。無(wú)向圖什么的基礎(chǔ)概念就不說(shuō)了。題目中給出了“關(guān)鍵結(jié)點(diǎn)”(key vertex)這個(gè)概念,就是你要選擇若干個(gè)關(guān)鍵結(jié)點(diǎn),這樣所有結(jié)點(diǎn)都跟關(guān)鍵結(jié)點(diǎn)連起來(lái)(至少有一條邊)。例子中的圖:

1 ?--- ?2

? ? ? ? ? |

4 ?--- ?3

可以看到有3條邊4個(gè)點(diǎn)。現(xiàn)在需要你的程序去選擇關(guān)鍵點(diǎn)。例如例子中給出的答案:選擇1和3作為關(guān)鍵點(diǎn),這樣其余結(jié)點(diǎn)(2和4)都至少跟1個(gè)關(guān)鍵結(jié)點(diǎn)相連(2根1、3相連,4跟3相連)。 也可以選擇2和4作為關(guān)鍵點(diǎn),也可以選擇2和3.一共有3種選擇方法(這就是程序要的輸出)。并且要求關(guān)鍵點(diǎn)是最少的,如果4個(gè)結(jié)點(diǎn)都是關(guān)鍵點(diǎn),毫無(wú)疑問(wèn)肯定符合其他要求,但是無(wú)法符合最少關(guān)鍵點(diǎn)的要求。

查看完整回答
反對(duì) 回復(fù) 2018-12-16
?
慕標(biāo)琳琳

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超9個(gè)贊

算出一共有多少種可能的關(guān)鍵點(diǎn)集合,使得任意關(guān)鍵點(diǎn)集合可以覆蓋圖中的所有邊。

查看完整回答
反對(duì) 回復(fù) 2018-12-16
  • 2 回答
  • 0 關(guān)注
  • 684 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)