跳到主要內容

發表文章

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

TopCoder SRM 345 DIV1 Pathfinding

滿強烈的思考題,四個象限分別考慮即可 // BEGIN CUT HERE // END CUT HERE #line 5 "GCAcode.cpp" #include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include < string > #include <iostream> #include <sstream> #include <map> #include <set> #include <queue> #include <stack> #include <fstream> #include <numeric> #include <iomanip> #include <bitset> #include <list> #include <stdexcept> #include <functional> #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)) ...

TopCoder SRM 195 DIV2 optimalCoins

題意是說要構成1~value分別只需要一種方法去付錢 思考題,想出方法之後就可以直接秒過去了 有點類似權值   // BEGIN CUT HERE // END CUT HERE #line 5 "GCAcode.cpp" #include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include < string > #include <iostream> #include <sstream> #include <map> #include <set> #include <queue> #include <stack> #include <fstream> #include <numeric> #include <iomanip> #include <bitset> #include <list> #include <stdexcept> #include <functional> #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; #de...

Codeforces Round #179 (Div. 2) D. Greg and Graph

偏向於思考題   題目看似很麻煩,不過可以想想floyd的原理   就是枚舉中間點,然後開始倆倆比對取最短   而這個問題就可以看成一張空圖然後一個點一個點加上去   然後把那個點當作中間點去做floyd   所以floyd只需要做一次即可搞定 // ############# ## ##### ## ############ // #### #### ## ####### ### #### #### // ## ##### ## ## ## ### #### ### ###### ## // ## ###### ## #### ######## ### ###### ## // ## ###### ## ## #### ## ### ###### ## // ## ## ## ######### ## ### ### // ############# ## ## ## ## ## ############## // ####### #### // ### ## ########## ## ## #### ###### // ################# ## ######## ############### // ################ ############## ###### # // ## ################## ######### ## # // ## ############## #### ########## #### // ############# ## ## ## ### ######## // ####### ###### #### ##### ##### // ########## ### ## #### ######### ## // ###### ### #...

Codeforces Round #110 (Div. 1) B. Suspects

思考邏輯題,其實只要枚舉所有人假設都是crmial的時候   如果真話剛好是m,那麼這個crimal就可以當作有可能是真的   注意n=10^5 所以不能用太慢的方法去解   // // GGGGGGGGGGGGG CCCCCCCCCCCCC AAA // GGG::::::::::::G CCC::::::::::::C A:::A // GG:::::::::::::::G CC:::::::::::::::C A:::::A // G:::::GGGGGGGG::::G C:::::CCCCCCCC::::C A:::::::A // G:::::G GGGGGG C:::::C CCCCCC A:::::::::A //G:::::G C:::::C A:::::A:::::A //G:::::G C:::::C A:::::A A:::::A //G:::::G GGGGGGGGGGC:::::C A:::::A A:::::A //G:::::G G::::::::GC:::::C A:::::A A:::::A //G:::::G GGGGG::::GC:::::C A:::::AAAAAAAAA:::::A //G:::::G G::::GC:::::C A:::::::::::::::::::::A // G:::::G G::::G C:::::C CCCCCC A:::::AAAAAAAAAAAAA:::::A // G:::::GGGGGGGG::::G C:::::CCCCCCCC::::C A:::::A ...

Codeforces Round #173 (Div. 2) C. XOR and OR

思考題,想一想發現只要有雙方都有至少一個1 那麼就一定是YES,如果只有0組成的字串就沒辦法了 // // GGGGGGGGGGGGG CCCCCCCCCCCCC AAA // GGG::::::::::::G CCC::::::::::::C A:::A // GG:::::::::::::::G CC:::::::::::::::C A:::::A // G:::::GGGGGGGG::::G C:::::CCCCCCCC::::C A:::::::A // G:::::G GGGGGG C:::::C CCCCCC A:::::::::A //G:::::G C:::::C A:::::A:::::A //G:::::G C:::::C A:::::A A:::::A //G:::::G GGGGGGGGGGC:::::C A:::::A A:::::A //G:::::G G::::::::GC:::::C A:::::A A:::::A //G:::::G GGGGG::::GC:::::C A:::::AAAAAAAAA:::::A //G:::::G G::::GC:::::C A:::::::::::::::::::::A // G:::::G G::::G C:::::C CCCCCC A:::::AAAAAAAAAAAAA:::::A // G:::::GGGGGGGG::::G C:::::CCCCCCCC::::C A:::::A A:::::A // GG:::::::::::::::G CC:::::::::::::::C A:::...