2017-03-22から1日間の記事一覧

単一始点最短経路 dijkstra法

C++

#include <bits/stdc++.h> using namespace std; static const int MAX_N = 100; static const int WHITE = 0;//未踏 static const int GRAY = 1;//確定している点と隣接 static const int BLACK = 2;//確定 static const int INF = 1<<21; int M[MAX_N][MAX_N] = {0};//隣</bits/stdc++.h>…

スクレイピング

imgタグのみを抽出する. # encoding : utf-8 # for python3 import urllib.request import os.path import pyquery as pq import requests from bs4 import BeautifulSoup import urllib.request from urllib.request import Request, urlopen #def download…

Python3で画像スクレイピング

指定したサイトで画像を一括ダウンロードできる. 備忘録とかそんな感じ — python3.xでweb上の画像を一括ダウンロード # encoding : utf-8 # for python3 import urllib.request import os.path import pyquery as pq import requests def download(url, fold…

全探索 整数を作れるかの問題

C++

配列の要素から整数を作れるかを判定する関数 #include <bits/stdc++.h> using namespace std; static const int MAX_N = 1000; int n;//配列Aの大きさ int m;//判定する整数 int A[MAX_N]; bool solve(int i,int m){ /* 整数mが作れるか否かの再起関数 */ if(m==0)return t</bits/stdc++.h>…