windowsでwgetの代わりは

Windowsでwget使いたい場面があったけど、ソフトインストールするのは癪だったので、プログラムちゃちゃっと書いて見ることにした pythonでやったらほんとにちゃちゃっと終わった が、出力については要改良BeautifulSoupすごい。prettify()メソッドが勝手に…

簡単なgraphの実装

頂点とそれと接続する頂点の情報をもつグラフ表現を書いた なんとなくprintメソッドが欲しくて書くけど,getメソッドを作ったほうがいいんだろうか #include <iostream> #include <vector> using namespace std; /* * グラフの表現 */ class graph{ private: struct vertex{ in</vector></iostream>…

union_findの実装

#include <iostream> #include <cstring> #include <vector> using namespace std; class union_find{ private: int *par; int *rank; int size; public: union_find(int n){ par = new int[n]; rank = new int[n]; size = n; for(int i=0; i</vector></cstring></iostream>

初めての投稿

testナップサック問題を解いた深さ優先探索を用いたものと、漸化式を利用した2重ループを用いた解法の2つ #include <iostream> #include <map> #include <queue> #include <algorithm> #include <cstring> using namespace std; typedef pair<int,int> P; int dfs(vector <P> vec, int i, int w, int v, int W){ if(</p></int,int></cstring></algorithm></queue></map></iostream>…