minikuraとは、箱で預ける収納サービスで
- Webで箱を申し込む
- ダンボールが送られてくる
- ダンボールに物を詰める
- Webで集荷を申し込む
- 宅配業者が自宅にくるのでダンボールを預ける
という手順でものを預けることが出来る。
クラウド上の収納スペースみたいなイメージ。
保管料は月額200円-。
今回は、冬物衣類を預けた。取り出すときは最短で翌日受け取ることが出来るらしい。なかなか便利なサービスだと思う。Webページのデザインもいい感じだ。
#include <iostream> using namespace std; int main() { long long A; cin >> A; int a[32] = {}; for (int i = 0; i < 32; i++) a[32-1-i] = A >> i & 1; for (int i = 0; i < 32; i++) cout << a[i] << " "; cout << endl; int dp[32+1][2] = {}; // dp[bit][LSBs are arbitrary or not?] dp[0][0] = 1; for (int k = 0; k < 32; k++) { // k : bit (notice that we process from MSB to LSB) for (int i = 0; i < 2; i++) { // i : the next bit is arbitrary or not? int jt = i == 1 ? 1 : a[k]; // jt : the maximum next bit for (int j = 0; j <= jt; j++) { // j : next bit dp[k+1][i | a[k] > j] += dp[k][i]; } } } cout << dp[32][1] << endl; // how many non-negative integers less than A are there? // "less than" means "not used up to A" -> LSBs are arbitrary. return 0; }MSBからLSBの方向に処理していきます。
using namespace std; #define ALL(x) (x).begin(), (x).end() #define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin(); itr!=(c).end(); itr++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define MP(x,y) make_pair(x,y) #define REP(i,n) for(int i=0; i<(int)(n); i++) void solve() { int A, B, K; cin >> A >> B >> K; int ar[32], br[32], kr[32]; // bit expression: ar[0] = MSB, ar[31] = LSB for (int i = 0; i < 32; i++) { ar[31-i] = A >> i & 1; br[31-i] = B >> i & 1; kr[31-i] = K >> i & 1; } long long dp[32+1][2][2][2] = {}; dp[0][0][0][0] = 1; for (int d = 0; d < 32; d++) { for (int i = 0; i < 2; i++) { // next ar bit is arbitrary? for (int j = 0; j < 2; j++) { // next br bit is arbitrary? for (int k = 0; k < 2; k++) { // next kr bit is arbitrary? if (dp[d][i][j][k] == 0) continue; int at = i == 1 ? 1 : ar[d]; int bt = j == 1 ? 1 : br[d]; for (int a = 0; a <= at; a++) { // next ar bit for (int b = 0; b <= bt; b++) { // next br bit int kk = a & b; // next kk bit if (k == 0 && kk > kr[d]) continue; dp[d+1][i | ar[d] > a][j | br[d] > b][k | kr[d] > kk] += dp[d][i][j][k]; } } } } } } cout << dp[32][1][1][1] << endl; } int main() { ios_base::sync_with_stdio(0); int T; cin >> T; REP (i, T) { cerr << "Case #" << i+1 << ": " << endl; cout << "Case #" << i+1 << ": "; solve(); } return 0; }
#include <stdio.h> #include <iostream> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/nonfree/nonfree.hpp" using namespace cv; static void help() { printf("Usage:\n dense_sample <image> \n"); } int main(int argc, char** argv) { if(argc != 2) { help(); return -1; } Mat img = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE); if(img.empty()) { printf("Can't read an image.x\n"); return -1; } DenseFeatureDetector detector( 4.0, // initFeatureScale (keypoints' diameter) 2, // featureScaleLevels (how many time apply detector with changing image scale) 0.5, // featureScaleMul (scale factor) 1, // initXyStep (distance between two keypoints) 0, // initImgBound (start axis of keypoints) false, // varyXyStepWithScale false // varyImgBoundWithScale ); // detecting keypoints vector<KeyPoint> keypoints; detector.detect(img, keypoints); // computing descriptors SurfDescriptorExtractor extractor; Mat descriptors; extractor.compute(img, keypoints, descriptors); // show info std::cout << "keypoints of img: " << keypoints.size() << std::endl; std::cout << "descriptors of img: " << descriptors.size() << std::endl; return 0; }
using namespace std; #define ALL(x) (x).begin(), (x).end() #define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin(); itr!=(c).end(); itr++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define MP(x,y) make_pair(x,y) #define REP(i,n) for(int i=0; i<(int)(n); i++) const int INF = 1e6; long long readLong() { string s; cin >> s; long long ret = 0; REP (i, s.length()) ret = 2 * ret + s[i] - '0'; return ret; } void solve() { int n, l; cin >> n >> l; vector<long long> a(n), b(n), c(n); REP (i, n) a[i] = readLong(); REP (i, n) b[i] = readLong(); sort(a.begin(), a.end()); int ret = INF; REP (i, n) { long long x = a[0] ^ b[i]; REP (j, n) c[j] = b[j] ^ x; sort(c.begin(), c.end()); if (a == c) ret = min(ret, __builtin_popcountll(x)); } if (ret == INF) cout << "NOT POSSIBLE" << endl; else cout << ret << endl; } int main() { ios_base::sync_with_stdio(0); int T; cin >> T; REP (i, T) { cerr << "Case #" << i+1 << ": " << endl; cout << "Case #" << i+1 << ": "; solve(); } return 0; }
using namespace std; #define ALL(x) (x).begin(), (x).end() #define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin(); itr!=(c).end(); itr++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define MP(x,y) make_pair(x,y) #define REP(i,n) for(int i=0; i<(int)(n); i++) const int INF = 1e6; int N; vector<int> edges[1000]; int dfs(int v, int par = -1) { int lch = 0; int rch = 0; REP (i, edges[v].size()) { int w = edges[v][i]; if (w == par) continue; int cnt = dfs(w, v); if (cnt > lch) swap(lch, cnt); if (cnt > rch) swap(rch, cnt); } if (!lch || !rch) // this node only return 1; return 1 + lch + rch; // has two children } void init() { REP (i, 1000) edges[i].clear(); } void solve() { cin >> N; REP(i, N-1) { int v, w; cin >> v >> w; --v, --w; edges[v].push_back(w); edges[w].push_back(v); } int ret = N-1; REP (k, N) ret = min(ret, N-dfs(k)); cout << ret << endl; } int main() { ios_base::sync_with_stdio(0); int T; cin >> T; REP (i, T) { cerr << "Case #" << i+1 << ": " << endl; cout << "Case #" << i+1 << ": "; init(); solve(); } return 0; }