2010-01-22から1日間の記事一覧

PKU 1029 False coin

PKU

False coini番目のコインが偽者と仮定して、計量の結果と矛盾が無いか調べる。矛盾の無いコインがちょうど1枚ならば、そのコインが偽者。 #include <iostream> #include <vector> #include <algorithm> using namespace std; bool contain( vector<int> v, int c ) { return find( v.begin(), </int></algorithm></vector></iostream>…

PKU 1028 Web Navigation

PKU

Web Navigation #include <iostream> #include <string> #include <vector> using namespace std; int main() { string current = "http://www.acm.org/"; vector<string> backward, forward; while ( true ) { string c; cin >> c; bool ignore = false; if ( c == "BACK" ) { if ( backward.e</string></vector></string></iostream>…

PKU 1027 The Same Game

PKU

The Same Game懐かしい。 C++だとTLE、G++で900MS。通ったから良しとしよう……。 #include <iostream> using namespace std; const int W = 15; const int H = 10; void cluster( char b[W][H], int c[W][H] ); void fall( char b[W][H] ); int main() { int n; cin >> </iostream>…