每日演算法 day 17

2022-02-14 00:46:18 字數 2377 閱讀 4044

那些你早出晚歸付出的刻苦努力,你不想訓練,當你覺的太累了但還是要咬牙堅持的時候,那就是在追逐夢想,不要在意終點有什麼,要享受路途的過程,或許你不能成就夢想,但一定會有更偉大的事情隨之而來。 mamba out~

2020.2.29

簡單模擬

#include #include #include #include typedef long long ll;

using namespace std;

const int n = 10002;

int k;

ll ans;

int main()

j++;

} cout << ans << endl;

return 0;

}

dfs 求連通圖

#include #include #include #include using namespace std;

const int n = 110;

int a[n][n] , n , m;

bool vis[n][n];

int dir[4][2] = ,,,};

long long ans , cnt;

bool inmap(int x,int y)

void dfs(int x,int y) }}

int main()

} for(int i = 1;i <= n ;i ++)

}} cout << ans << endl;

return 0;

}

dfs + 剪枝

#include #include #include #include #include using namespace std;

const int n = 110;

int n ;

int dir[9][2] = ,,,,,

,,,};

char map[n][n];

bool vis[n][n];

string format = "yizhong";

struct node;

bool inmap(int x,int y)

void dfs(int x,int y,int now,string s,vectorpath,int direct)

return;

}else);

dfs(nx,ny,now+1,s+format[now],path,i);

path.pop_back();

}else if(direct == i)

);dfs(nx,ny,now+1,s+format[now],path,i);

path.pop_back();}}

}} }

}void outans()

puts(""); }}

int main()

for(int i = 1;i <= n ;i ++)

); dfs(i,j,1,"y",path,0);

} }

} outans();

return 0;

}

大佬說把他從高往看成一條線,看落在那種顏色的線上就可以判斷最終落在了**,而且題目中的資料會出現重疊情況!!思路可以細細品

#include #include #include #include #include using namespace std;

const int n = 20202;

struct nodea[10101];

int ans[n];

int n ;

bool cmp1(node a,node b)

bool cmp2(node a,node b)

int main()

sort(a,a+n,cmp1);

for(int i = 0;i < n ;i ++) }

sort(a,a+n,cmp2);

for(int i = 0;i < n ;i ++)

return 0;

}

#include #include #include #include #include using namespace std;

const int n = 10;

int n,a[n];

bool vis[n];

void dfs(int now)

cout << endl;

} for(int i = 1;i <= n;i ++) }

}int main()

實習日記 Day17

今日份 更新 今日份流水賬 需求更新 身為乙方,每當甲方需求更新的時候,應該都很煩吧。但是我發現我自己,也許是性格使然吧,居然覺得能盡可能去滿足客戶的需求,也是一件很有成就感的事。反倒是讓我提需求的話,我會產生一種給別人添麻煩的不適感 不過這也可能是我今日份的感想,換個日子興許就不這樣想了。工具更新...

day17物件導向

1.面向過程程式設計 一遇到問題馬上想到的是怎麼用演算法或者步驟 邏輯 直接解決問題 2.函式式程式設計 一遇到問題馬上想到有沒有乙個函式具有解決這個問題的功能,如果有直接拿過來用,沒有就自己定義乙個 3.物件導向程式設計 遇到問題馬上想到有沒有乙個物件具有解決這個問題的能力,如果有直接拿過來用,沒...

資料結構和演算法 Day 17

將單鏈表中終端節點的指標端由空指標改為指向頭節點,就使整個單鏈表形成乙個環,這種頭尾相接的單鏈表稱為單迴圈列表,簡稱迴圈列表。迴圈列表的主要差異就在於迴圈的判斷空列表的條件上,原來判斷head next是否為null,現在則是head next是否等於head 終端節點用尾指標rear指示,則查詢終...