題目連結題意: 有n個男孩和m個女孩,他們要結對跳舞,每對要有一個女孩和一個男孩,而且其中一個要求之前沒有和其他人結對,求出最大可以結多少對。,一條線代表一對,只有這樣三種情況。#include <iostream>#include <algorithm>#include <stdio.h>using namespace std;int main(){ int n, m; while (cin >> n >> m)
題目連結有紅綠藍三種顏色的畫,每種拿三朵可以組成一束花,或者各拿一朵組成花束,告訴你每種花的數目,求出可能組成最多的花束。如果你的代碼過不了,考慮一下 8 8 9這種組合。 因為資料量很大,我的思想就是局部和總體採用不同的策略。#include <iostream>#include <algorithm>using namespace std;int main(){ int r, g, b; while (cin >> r >> g
DFS(Depth First Search )一般是不用hash的,所以很多時候稱之為”暴力”,也就是窮舉所有情況,一般看幾個我們OJ的dfs的版本的題目就可以模仿著做了,因為牽涉到遞迴,初學者學的時候最好能舉一反三,理解其中真諦.DFS --- EASY(15) Tempter of theBone Safecracker Prime RingProblem Robot Motion Fire Net 猜數字
B. Airporttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions
題目連結A.Snow FootprintsA - Snow FootprintsThe starting position can be anywhere with a footprint. The footprints can be categorized into 3 types.only L sonly R sR s followed by L sIn case 1, we end in the left of all footprints. In case 2, we end in
Is the Information Reliable?Time Limit: 3000MS Memory Limit: 131072KTotal Submissions: 9905 Accepted: 3072DescriptionThe galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense