跳到主要內容

發表文章

目前顯示的是有「AOJ」標籤的文章

AOJ 1320 City Merger

有點麻煩的題目,算出overlap,然後再計算有沒有子字串在裡面,子字串可以直接不用考慮 那麼把剩餘的點拿來做Hamilton Path最小成本即可 /* * GCA : "Computer is artificial subject absolutely,Math is God" */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <climits> #include <vector> #include <set> #include <map> #include <queue> #include <cctype> #include <utility> #include <ctime> using namespace std; #ifdef DEBUG #define VAR(a,b) __typeof(b) a=(b) #define debug(...) printf( "DEBUG: " ),printf(__VA_ARGS__) #else #define VAR(a,b) __typeof(b) a=(b) #define debug(...) #endif typedef unsigned int uint ; typedef long long int Int; typedef unsigned long long int UInt; #define Set(a,s) memset(a,s, sizeof (a)) #define Pln() printf( "\n" ) #define For(i,x) for ( int i=0;i<x;i++) #define CON(x,y) x##y #define M 25 #define PB push_back #define oo INT_MAX #define FOR(a...

AOJ 1316 The Sorcerer's Donut

  全部列舉出來 然後暴力的放進去hash 搞定 /* * GCA : "Computer is artificial subject absolutely,Math is God" */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <climits> #include <vector> #include <set> #include <map> #include <queue> #include <cctype> #include <utility> #include <ctime> using namespace std; #ifdef DEBUG #define VAR(a,b) __typeof(b) a=(b) #define debug(...) printf( "DEBUG: " ),printf(__VA_ARGS__) #else #define VAR(a,b) __typeof(b) a=(b) #define debug(...) #endif typedef unsigned int uint ; typedef long long int Int; typedef unsigned long long int UInt; #define Set(a,s) memset(a,s, sizeof (a)) #define Pln() printf( "\n" ) #define For(i,x) for ( int i=0;i<x;i++) #define CON(x,y) x##y #define M 25 #define PB push_back #define oo INT_MAX #define FOR(a,b) for (VAR(a,(b).begin());a!=(b).end();++a) #de...