锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91精品国产高清久久久久久国产嫩草,a高清免费毛片久久,精品久久久久久国产潘金莲 http://m.shnenglu.com/rakerichard/archive/2011/09/06/155228.htmllee1r lee1r Tue, 06 Sep 2011 12:27:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/09/06/155228.html http://m.shnenglu.com/rakerichard/comments/155228.html http://m.shnenglu.com/rakerichard/archive/2011/09/06/155228.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/155228.html http://m.shnenglu.com/rakerichard/services/trackbacks/155228.html 姣斿瀵逛簬絎簩涓牱渚嬪緱鍒?錛?錛?錛?錛?錛?錛?錛?錛?銆備粠鍚庡悜鍓嶇涓涓崌搴忔槸3錛屾墍浠ヨ緭鍑?錛?錛?銆?br />浠ヤ笅鏄垜鐨勪唬鐮侊紙鍥э級錛?br /> 1 #include < iostream > 2 #include < string > 3 #include < cstdio > 4 using namespace std; 5 6 const int kMaxn = 1007 ; 7 8 int n, r[kMaxn]; 9 string init[kMaxn], aim[kMaxn]; 10 11 void Input () 12 { 13 scanf ( " %d " , & n ); 14 getchar(); 15 for ( int i = 1 ; i <= n; i ++ ) 16 getline ( cin, init[i] ); 17 for ( int i = 1 ; i <= n; i ++ ) 18 { 19 getline ( cin, aim[i] ); 20 for ( int j = 1 ; j <= n; j ++ ) 21 if ( aim[i] == init[j] ) 22 { 23 r[i] = j; 24 break ; 25 } 26 } 27 for ( int i = 1 ; i <= n; i ++ ) 28 printf ( " %d " , r[i] ); 29 puts ( "" ); 30 } 31 32 void Solve () 33 { 34 int pos = - 1 ; 35 for ( int i = n; i >= 2 ; i -- ) 36 if ( r[i - 1 ] > r[i] ) 37 { 38 pos = i - 1 ; 39 break ; 40 } 41 if ( pos != - 1 ) 42 { 43 for ( int i = pos; i >= 1 ; i -- ) 44 printf ( " %s\n " , aim[i].c_str() ); 45 } 46 } 47 48 int main () 49 { 50 #ifndef ONLINE_JUDGE 51 freopen ( " data.in " , " r " , stdin ); 52 #endif 53 54 int T; 55 scanf ( " %d " , & T ); 56 while ( T -- ) 57 { 58 Input (); 59 60 Solve (); 61 62 printf ( " \n " ); 63 } 64 65 return 0 ; 66 } 67
]]> POJ 2388 Who's in the Middle http://m.shnenglu.com/rakerichard/archive/2011/08/04/152461.htmllee1r lee1r Thu, 04 Aug 2011 12:36:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/08/04/152461.html http://m.shnenglu.com/rakerichard/comments/152461.html http://m.shnenglu.com/rakerichard/archive/2011/08/04/152461.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/152461.html http://m.shnenglu.com/rakerichard/services/trackbacks/152461.html 鎺掑簭銆?br />浠ヤ笅鏄垜鐨勪唬鐮侊細/* * Author: lee1r * Created Time: 2011/8/4 20:20:15 * File Name: poj2388.cpp */ #include< iostream > #include< sstream > #include< fstream > #include< vector > #include< list > #include< deque > #include< queue > #include< stack > #include< map > #include< set > #include< bitset > #include< algorithm > #include< cstdio > #include< cstdlib > #include< cstring > #include< cctype > #include< cmath > #include< ctime > #define L(x) ((x)<<1) #define R(x) (((x)<<1)+1) #define Half(x) ((x)>>1) #define lowbit(x) ((x)&(-(x))) using namespace std; const int kInf( 0x7f7f7f7f ); const double kEps(1e - 11 ); typedef long long int64; typedef unsigned long long uint64; int n,r[ 10007 ]; int main() { // freopen("data.in","r",stdin); while (scanf( " %d " , & n) == 1 ) { for ( int i = 1 ;i <= n;i ++ ) scanf( " %d " , & r[i]); sort(r + 1 ,r + n + 1 ); printf( " %d\n " ,r[Half(n + 1 )]); } return 0 ; }
]]> UVa 10057 A mid-summer night's dream. http://m.shnenglu.com/rakerichard/archive/2011/05/20/146821.htmllee1r lee1r Fri, 20 May 2011 08:30:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/05/20/146821.html http://m.shnenglu.com/rakerichard/comments/146821.html http://m.shnenglu.com/rakerichard/archive/2011/05/20/146821.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/146821.html http://m.shnenglu.com/rakerichard/services/trackbacks/146821.html #include < vector > #include< algorithm > #include< cstdio > using namespace std; int main() { #ifndef ONLINE_JUDGE freopen( " data.in " , " r " ,stdin); freopen( " data.out " , " w " ,stdout); #endif int n; while (scanf( " %d " , & n) == 1 ) { vector < int > r; for ( int i = 0 ;i < n;i ++ ) { int t; scanf( " %d " , & t); r.push_back(t); } sort(r.begin(),r.end()); int ansa,ansb,ansc; if (n & 1 ) { ansa = r[n >> 1 ]; ansb = upper_bound(r.begin(),r.end(),r[n >> 1 ]) - lower_bound(r.begin(),r.end(),r[n >> 1 ]); ansc = 1 ; } else { ansa= r[(n >> 1 ) - 1 ]; ansb = upper_bound(r.begin(),r.end(),r[(n >> 1 ) - 1 ]) - lower_bound(r.begin(),r.end(),r[(n >> 1 ) - 1 ]); if (r[(n >> 1 ) - 1 ] != r[n >> 1 ]) ansb += upper_bound(r.begin(),r.end(),r[(n >> 1 )]) - lower_bound(r.begin(),r.end(),r[(n >> 1 )]); ansc = r[n >> 1 ] - r[(n >> 1 ) - 1 ] + 1 ; } printf( " %d %d %d\n " ,ansa,ansb,ansc); } return 0 ; } 榪欓亾棰樼洰閲嶇偣鍦ㄤ簬涓綅鏁幫綖涓綅鏁頒竴瀹氬彲浠ヤ嬌寰楁渶緇堢粨鏋滄渶灝忋?br />浠ヤ笅鏄垜鐨勪唬鐮侊細 ]]>UVa 10132 File Fragmentation http://m.shnenglu.com/rakerichard/archive/2011/05/20/146820.htmllee1r lee1r Fri, 20 May 2011 07:44:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/05/20/146820.html http://m.shnenglu.com/rakerichard/comments/146820.html http://m.shnenglu.com/rakerichard/archive/2011/05/20/146820.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/146820.html http://m.shnenglu.com/rakerichard/services/trackbacks/146820.html 棣栧厛錛屽師涓茬殑闀垮害涓瀹氭槸鎵撶浜嗕箣鍚庣殑涓蹭腑鏈闀跨殑闀垮害鍔犱笂鏈鐭殑闀垮害銆傝鎵撶涔嬪悗鐨勪覆涓渶闀夸覆緇勬垚闆嗗悎S錛屾渶鐭覆緇勬垚闆嗗悎T錛岄偅涔堝師涓茶偗瀹氫負ST鎴朤S涓殑鏌愮銆傜敱浜嶴銆乀涓厓绱犱釜鏁板繀瀹氬皬浜庣瓑浜?錛屾墍浠ュ彲鑳界殑緇撴灉鏈澶氬彧鏈?縐嶃傛灇涓捐繖8縐嶇粨鏋滐紝鐒跺悗媯嫻嬫槸鍚︾鍚堣姹傚嵆鍙?br />媯嫻嬬殑鏃跺欙紝瀵逛簬鏌愪釜闀垮害涓篖鐨勪覆錛岃蹇熸绱㈠埌闀垮害涓猴紙maxlength+minlength-L錛夌殑涓詫紝浣跨敤multimap<int,string>鍙互寰堟柟渚垮湴鍋氬埌銆?br />浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< vector > #include< string > #include< map > #include< algorithm > #include< cstdio > using namespace std; bool cmp( const string & a, const string & b) { return (a.size() < b.size() || (a.size() == b.size() && a < b)); } int main() { #ifndef ONLINE_JUDGE freopen( " data.in " , " r " ,stdin); freopen( " data.out " , " w " ,stdout); #endif int T; cin >> T; cin. get (); cin. get (); bool first( true ); while (T -- ) { int minl( 0x7f7f7f7f ),maxl( 0 ); vector < string > a; string t; while (getline(cin,t) && ! t.empty()) { a.push_back(t); minl = min(minl,( int )(t.size())); maxl = max(maxl,( int )(t.size())); } sort(a.begin(),a.end(),cmp); a.erase(unique(a.begin(),a.end()),a.end()); multimap < int , string > r; for ( int i = 0 ;i < a.size();i ++ ) r.insert(make_pair(a[i].size(),a[i])); string ans; multimap < int , string > ::iterator ibegin = r.begin(), iend = r.upper_bound(minl), jend = r.end(), jbegin = r.lower_bound(maxl); for (multimap < int , string > ::iterator i = ibegin;i != iend;i ++ ) for (multimap < int , string > ::iterator j = jbegin;j != jend;j ++ ) { string now(i -> second + j -> second); bool success( true ); for (multimap < int , string > ::iterator k = r.begin();k != r.end();k ++ ) { multimap < int , string > ::iterator pbegin = r.lower_bound(minl + maxl - k -> first), pend = r.upper_bound(minl + maxl - k -> first); bool can( false ); for (multimap < int , string > ::iterator l = pbegin;l != pend;l ++ ) { if (k -> second + l -> second == now || l -> second + k -> second == now) can = true ; } if ( ! can) { success = false ; break ; } } if (success) ans = now; now = j -> second + i -> second; success = true ; for (multimap < int , string > ::iterator k = r.begin();k != r.end();k ++ ) { multimap < int , string > ::iterator pbegin = r.lower_bound(minl + maxl - k -> first), pend = r.upper_bound(minl + maxl - k -> first); bool can( false ); for (multimap < int , string > ::iterator l = pbegin;l != pend;l ++ ) { if (k -> second + l -> second == now || l -> second + k -> second == now) can = true ; } if ( ! can) { success = false ; break ; } } if (success) ans = now; } if (first) first = false ; else cout<< endl; cout << ans << endl; } return 0 ; }
]]> UVa 10905 Children's Game http://m.shnenglu.com/rakerichard/archive/2011/05/20/146802.htmllee1r lee1r Fri, 20 May 2011 03:32:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/05/20/146802.html http://m.shnenglu.com/rakerichard/comments/146802.html http://m.shnenglu.com/rakerichard/archive/2011/05/20/146802.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/146802.html http://m.shnenglu.com/rakerichard/services/trackbacks/146802.html 棰樼洰澶ф剰錛氱粰鍑簄錛坣<=50錛変釜鏁板瓧錛宯涓暟瀛楁寜鏌愮欏哄簭榪炴帴錛岃姹傛渶緇堝緱鍒扮殑鏁板瓧鏈澶с?br />鐢變簬涓嶈鎬庝箞榪炴帴錛屾渶緇堝緱鍒版暟瀛楃殑闀垮害鎬繪槸鐩稿悓鐨勶紝鎵浠ユ瘮杈冨ぇ灝忕殑鏂瑰紡錛岀浉褰撲簬姣旇緝鏁板瓧瀵瑰簲鐨勫瓧絎︿覆鐨勫瓧鍏稿簭澶у皬銆備簬鏄彲浠ユ妸杈撳叆涓殑n涓暟瀛楃湅浣滃瓧絎︿覆銆?br />鑰冭檻鍙湁涓や釜瀛楃涓茬殑鎯呭喌錛岃涓篴鍜宐錛岀粨鏋滆涔堟槸a+b錛岃涔堟槸b+a錛?+'琛ㄧず瀛楃涓茶繛鎺ワ級銆備簬鏄紝濡傛灉a+b>b+a錛岄偅涔坅搴旇鎺掑湪b鐨勫墠闈€傛墍浠ュ彧闇瑕佹寜鐓ц繖縐嶈鍒欑粰n涓瓧絎︿覆鎺掑簭鍗沖彲銆?br />鍋氳繖閬撻鐨勬椂鍊欎笉鏄湪瀹訛紝榪欏彴鐢佃剳閲岄潰鍙堟病鏈夎g++浠涔堢殑錛屽啓瀹屼唬鐮佷箣鍚庢病鏈夌紪璇戣繍琛岀洿鎺ユ彁浜ょ殑錛屼簬鏄疉C銆?br />浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< string > #include< algorithm > #include< cstdio > using namespace std; const int kMaxn( 57 ); bool cmp( const string & a, const string & b) { return (a + b > b + a); } int main() { #ifndef ONLINE_JUDGE freopen( " data.in " , " r " ,stdin); freopen( " data.out " , " w " ,stdout); #endif int n; while (cin >> n && n) { string r[kMaxn]; for ( int i = 1 ;i <= n;i ++ ) cin >> r[i]; sort(r + 1 ,r + n + 1 ,cmp); for ( int i = 1 ;i <= n;i ++ ) cout << r[i]; cout << endl; } return 0 ; }
]]> UVa 10487 Closest Sums http://m.shnenglu.com/rakerichard/archive/2011/05/19/146769.htmllee1r lee1r Thu, 19 May 2011 11:34:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/05/19/146769.html http://m.shnenglu.com/rakerichard/comments/146769.html http://m.shnenglu.com/rakerichard/archive/2011/05/19/146769.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/146769.html http://m.shnenglu.com/rakerichard/services/trackbacks/146769.html 鎴戠殑鍋氭硶鏄繖鏍風殑錛屾妸n涓暟瀛椾袱涓ゆ眰鍜岀殑緇撴灉瀛樺湪鏁扮粍閲岄潰錛屾帓搴忥紝鍘婚噸錛堣繖涓姝ユ棤鎵璋擄級銆傛瘡褰撶粰鍑轟竴涓獂鐨勬椂鍊欙紝浜屽垎鏌ユ壘澶т簬絳変簬x鐨勭涓涓暟瀛楋紝鍜屽皬浜巟鐨勬渶鍚庝竴涓暟瀛椼傛瘮杈冨嵆鍙緱鍑虹粨鏋溿?br />浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < vector > #include< algorithm > #include< cstdio > #include< cstdlib > using namespace std; int main() { #ifndef ONLINE_JUDGE freopen( " data.in " , " r " ,stdin); freopen( " data.out " , " w " ,stdout); #endif int case_num( 0 ),n; while (scanf( " %d " , & n) == 1 && n) { vector < int > a,r; for ( int i = 0 ;i < n;i ++ ) { int t; scanf( " %d " , & t); a.push_back(t); for ( int j = 0 ;j < i;j ++ ) r.push_back(a[j] + t); } sort(r.begin(),r.end()); r.erase(unique(r.begin(),r.end()),r.end()); /* for(int i=0;i<r.size();i++) { if(i!=0) printf(" "); printf("%d",r[i]); } printf("\n"); //*/ case_num++ ; printf( " Case %d:\n " ,case_num); int m; scanf( " %d " , & m); for ( int i = 1 ;i <= m;i ++ ) { int x; scanf( " %d " , & x); int dist( 0x7f7f7f7f ),ans; vector < int > ::iterator lpos(lower_bound(r.begin(),r.end(),x)); if (lpos != r.end()) { int t =* lpos; if (dist > abs(t - x)) { dist = abs(t - x); ans = t; } } if (lpos != r.begin()) { int t =* (lpos - 1 ); if (dist > abs(t - x)) { dist = abs(t - x); ans = t; } } printf( " Closest sum to %d is %d.\n " ,x,ans); } } }
]]> UVa 755 487--3279 http://m.shnenglu.com/rakerichard/archive/2011/04/11/143988.htmllee1r lee1r Mon, 11 Apr 2011 15:53:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/11/143988.html http://m.shnenglu.com/rakerichard/comments/143988.html http://m.shnenglu.com/rakerichard/archive/2011/04/11/143988.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143988.html http://m.shnenglu.com/rakerichard/services/trackbacks/143988.html 鐢╩ap<string,int>寰堣交鏉懼氨鍙互瀹屾垚璇ラ銆?br>浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< string > #include< map > #include< algorithm > #include< cstdio > #include< cctype > using namespace std; const char kTable[] = " 2223334445556667777888999 " ; int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ int T; cin >> T; bool first_output( true ); while (T -- ) { int n; cin >> n; map < string , int > r; for ( int i = 1 ;i <= n;i ++ ) { string t; cin >> t; t.erase(remove(t.begin(),t.end(), ' - ' ),t.end()); for ( int j = 0 ;j < t.size();j ++ ) if ( ! isdigit(t[j])) t[j] = kTable[t[j] - ' A ' ]; t.insert( 3 , " - " ); r[t] ++ ; } if (first_output) first_output = false ; else cout<< endl; bool found( false ); for (map < string , int > ::iterator i = r.begin();i != r.end();i ++ ) if (i -> second > 1 ) { cout << i -> first << " " << i -> second << endl; found = true ; } if ( ! found) cout << " No duplicates. " << endl; } return 0 ; }
]]> UVa 10194 Football (aka Soccer) http://m.shnenglu.com/rakerichard/archive/2011/04/11/143931.htmllee1r lee1r Mon, 11 Apr 2011 04:02:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/11/143931.html http://m.shnenglu.com/rakerichard/comments/143931.html http://m.shnenglu.com/rakerichard/archive/2011/04/11/143931.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143931.html http://m.shnenglu.com/rakerichard/services/trackbacks/143931.html 榪樹笉閿欙紝涓嬈C銆傝鍏ユ暟鎹椂鐢╟in/stringin姣旇緝鏂逛究澶勭悊錛岃緭鍑烘椂鍒欐崲鐢╬rintf銆傚彟澶栨敞鎰忓鍏抽敭瀛楁帓搴忥紝瑙夊緱榪欓榪樻槸浣跨敤澶氭鎺掑簭姣旇緝鏂逛究緙栫▼銆?br>浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< sstream > #include< vector > #include< string > #include< algorithm > #include< cstdio > #include< cctype > using namespace std; struct Type { Type() { name_ = "" ; score_ = win_ = lose_ = draw_ = goal_ = all_goal_ = game_ = 0 ; } string name_; int score_,win_,lose_,draw_,goal_,all_goal_,game_; }; int n; vector < Type > r; int Team( const string & team_name) { for ( int i = 0 ;i < n;i ++ ) if (r[i].name_ == team_name) return i; } bool cmp_1( const Type & a, const Type & b) { string aa(a.name_),bb(b.name_); for ( int i = 0 ;i < aa.size();i ++ ) aa[i] = tolower(aa[i]); for ( int i = 0 ;i < bb.size();i ++ ) bb[i] = tolower(bb[i]); return aa < bb; } bool cmp_2( const Type & a, const Type & b) { return a.game_ < b.game_; } bool cmp_3( const Type & a, const Type & b) { return a.all_goal_ > b.all_goal_; } bool cmp_4( const Type & a, const Type & b) { return a.goal_ > b.goal_; } bool cmp_5( const Type & a, const Type & b) { return a.win_ > b.win_; } bool cmp_6( const Type & a, const Type & b) { return a.score_ > b.score_; } int main() { int T; cin >> T; getchar(); bool first( true ); while (T -- ) { string game_name; getline(cin,game_name); cin >> n; getchar(); r.resize(n); for ( int i = 0 ;i < n;i ++ ) getline(cin,r[i].name_); int g; cin >> g; getchar(); string s; for ( int i = 0 ;i < g;i ++ ) { getline(cin,s); int pos_1(s.find( ' # ' )),pos_2(s.rfind( ' # ' )); string team_1(s.substr( 0 ,pos_1)),team_2(s.substr(pos_2 + 1 )); istringstream sin(s.substr(pos_1 + 1 )); int goal_1,goal_2; sin >> goal_1; char ch; sin >> ch; sin >> goal_2; int team_1_num(Team(team_1)),team_2_num(Team(team_2)); r[team_1_num].all_goal_ += goal_1; r[team_1_num].goal_ += (goal_1 - goal_2); r[team_1_num].game_ ++ ; r[team_2_num].all_goal_ += goal_2; r[team_2_num].goal_ += (goal_2 - goal_1); r[team_2_num].game_ ++ ; if (goal_1 > goal_2) { r[team_1_num].score_ += 3 ; r[team_1_num].win_ ++ ; r[team_2_num].lose_ ++ ; } else if (goal_1 < goal_2) { r[team_2_num].score_ += 3 ; r[team_2_num].win_ ++ ; r[team_1_num].lose_ ++ ; } else { r[team_1_num].score_++ ; r[team_2_num].score_ ++ ; r[team_1_num].draw_ ++ ; r[team_2_num].draw_ ++ ; } } sort(r.begin(),r.end(),cmp_1); stable_sort(r.begin(),r.end(),cmp_2); stable_sort(r.begin(),r.end(),cmp_3); stable_sort(r.begin(),r.end(),cmp_4); stable_sort(r.begin(),r.end(),cmp_5); stable_sort(r.begin(),r.end(),cmp_6); if (first) first = false ; else cout<< endl; cout << game_name << endl; for ( int i = 0 ;i < n;i ++ ) printf( " %d) %s %dp, %dg (%d-%d-%d), %dgd (%d-%d)\n " ,i + 1 ,r[i].name_.c_str(),r[i].score_,r[i].game_,r[i].win_,r[i].draw_,r[i].lose_,r[i].goal_,r[i].all_goal_,r[i].all_goal_ - r[i].goal_); fill_n(r.begin(),n,Type()); } return 0 ; }
]]>UVa 123 Searching Quickly http://m.shnenglu.com/rakerichard/archive/2011/04/11/143901.htmllee1r lee1r Sun, 10 Apr 2011 17:50:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/11/143901.html http://m.shnenglu.com/rakerichard/comments/143901.html http://m.shnenglu.com/rakerichard/archive/2011/04/11/143901.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143901.html http://m.shnenglu.com/rakerichard/services/trackbacks/143901.html STL涓?lt;set>銆?lt;map>紲炲櫒錛佺敤璧鋒潵寰堟柟渚匡紝鍙槸鎷呭績鎴戝啀榪欎箞鐢ㄤ笅鍘籕sort銆丅search浠涔堢殑鑷繁閮戒笉浼氬啓浜嗭綖 浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< string > #include< map > #include< set > #include< cstdio > #include< cctype > using namespace std; const int kMaxn( 207 ); const string kSign( " :: " ); int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ set < string > ignore; string t; while (getline(cin,t) && t != kSign) ignore.insert(t); multimap < string , string > r; while (getline(cin,t)) { for ( int i = 0 ;i < t.size();i ++ ) t[i] = tolower(t[i]); for ( int i = 0 ;i < t.size();i ++ ) { if ( ! isalpha(t[i])) continue ; int j(i); string t2; while (j < t.size() && isalpha(t[j])) { t2 += t[j]; j ++ ; } if ( ! ignore.count(t2)) { for ( int k = 0 ;k < t2.size();k ++ ) t2[k] = toupper(t2[k]); string t3(t); t3.replace(i,t2.size(),t2); r.insert(make_pair(t2,t3)); } i = j; } } for (map < string , string > ::iterator i = r.begin();i != r.end();i ++ ) cout << i -> second << endl; return 0 ; }
]]> UVa 400 Unix ls http://m.shnenglu.com/rakerichard/archive/2011/04/09/143808.htmllee1r lee1r Sat, 09 Apr 2011 09:24:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/09/143808.html http://m.shnenglu.com/rakerichard/comments/143808.html http://m.shnenglu.com/rakerichard/archive/2011/04/09/143808.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143808.html http://m.shnenglu.com/rakerichard/services/trackbacks/143808.html 棰樼洰瑕佹眰妯℃嫙Unix涓媗s鍛戒護銆傜粰鍑轟竴浜涘垪鏂囦歡鍚嶏紝鎸夊瓧鍏稿簭鎺掑簭涔嬪悗錛屼互鍒椾紭鍏堢殑鏂瑰紡杈撳嚭銆傞櫎浜嗘渶鍚庝竴鍒椾箣澶栵紝鍏朵綑鍚勫垪鎵鍗犵殑瀛楃鏁頒負鏈闀挎枃浠跺悕闀垮害鍔?錛屾渶鍚庝竴鍒楁墍鍗犳暟鐩負鏈闀挎枃浠跺悕闀垮害銆傛瘡琛屽瓧絎︽暟涓嶈兘瓚呰繃60錛岃姹傛渶緇堢殑琛屾暟鏈灝戙?br>WA浜?嬈★紝瀹炲湪涓嶅簲璇ワ紝鍒楄緭鍑烘柟寮忔病鏈夋帶鍒跺ソ銆傛垜鐨勫仛娉曟槸鍏堣緭鍑哄埌浜岀淮string鏁扮粍涓紝鍥犱負榪欎釜鏁扮粍騫朵笉涓瀹氳濉弧錛岃繖鏍蜂竴鏉ユ帴涓嬫潵杈撳嚭鏃舵湁澶氱閫夋嫨錛?銆佸仛鏍囪錛屾病鏈夎鏍囪鐨勫厓绱犱笉鐢ㄨ緭鍑猴紙鎴戞渶鍒濊繖涓姝ユ病鏈夊仛濂斤級錛?銆佸垽鏂?i,j)瀵瑰簲鐨勬枃浠跺悕鏁扮粍涓殑浣嶇疆鏄惁瓚婄晫錛堜笉鍗犵敤棰濆絀洪棿錛屼笉鐢ㄥ浜岀淮string鏁扮粍璧嬪鹼級銆?br>浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< string > #include< algorithm > #include< cstdio > using namespace std; const int kMaxn( 107 ); string r[kMaxn],ls[kMaxn][kMaxn]; int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ int n; while (cin >> n) { int max_length( 0 ); for ( int i = 1 ;i <= n;i ++ ) { cin >> r[i]; max_length = max(max_length,static_cast < int > (r[i].size())); } sort(r + 1 ,r + n + 1 ); int row_num,column_num; for (row_num = 1 ;row_num <= n;row_num ++ ) { column_num = n / row_num; if (n % row_num) column_num ++ ; if ((max_length + 2 ) * (column_num - 1 ) + max_length <= 60 ) break ; } for ( int i = 1 ,x = 1 ,y = 1 ;i <= n;i ++ ) { ls[x][y] = r[i]; x ++ ; if (x > row_num) { x = 1 ; y ++ ; } } for ( int i = 1 ;i <= 60 ;i ++ ) cout << " - " ; cout << endl; for ( int i = 1 ;i <= row_num;i ++ ) { for ( int j = 1 ;j <= column_num;j ++ ) { if ((j - 1 ) * row_num + i <= n) { cout << ls[i][j]; for ( int k = ls[i][j].size();k < (j == column_num ? max_length:(max_length + 2 ));k ++ ) cout << " " ; } } cout << endl; } } return 0 ; }
]]> UVa 10785 The Mad Numerologist http://m.shnenglu.com/rakerichard/archive/2011/04/09/143799.htmllee1r lee1r Sat, 09 Apr 2011 05:30:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/09/143799.html http://m.shnenglu.com/rakerichard/comments/143799.html http://m.shnenglu.com/rakerichard/archive/2011/04/09/143799.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143799.html http://m.shnenglu.com/rakerichard/services/trackbacks/143799.html 浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< string > #include< algorithm > #include< cstdio > using namespace std; const string kStr( " AJAJAJAJAJASASASASASABABABABABAKAKAKAKAKATUTUTUTUTUCUCUCUCUCULULULULULUDUDUDUDUDUMUMEMEMEMEVEVEVEVEVENENENENENEWEWEWEWEWEFEFEFOFOFOXOXOXOXOXOGOGOGOGOGOPOPOPOPOPOYOYOYOYIYIHIHIHIHIHIQIQIQIQIQIZIZIZIZIZIRIRIRIRIR " ); int main() { int T; cin >> T; for ( int case_num = 1 ;case_num <= T;case_num ++ ) { int n; cin >> n; string ans(kStr.substr( 0 ,n)); string odd,even; for ( int i = 0 ;i < n;i += 2 ) odd += ans[i]; for ( int i = 1 ;i < n;i += 2 ) even += ans[i]; sort(odd.begin(),odd.end()); sort(even.begin(),even.end()); cout << " Case " << case_num << " : " ; for ( int i = 0 ;i < n;i ++ ) if (i & 1 ) cout << even[i >> 1 ]; else cout<< odd[i >> 1 ]; cout << endl; } return 0 ; }
]]> UVa 156 Ananagrams http://m.shnenglu.com/rakerichard/archive/2011/04/09/143786.htmllee1r lee1r Sat, 09 Apr 2011 03:06:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/09/143786.html http://m.shnenglu.com/rakerichard/comments/143786.html http://m.shnenglu.com/rakerichard/archive/2011/04/09/143786.html#Feedback 4 http://m.shnenglu.com/rakerichard/comments/commentRss/143786.html http://m.shnenglu.com/rakerichard/services/trackbacks/143786.html STL浼氫笉浼氶檷浣巆oder璁捐綆楁硶鐨勮兘鍔涘晩錛熸垜閮芥媴蹇冧簡锝炵幇鍦ㄦ垚浜哠TL鎺э紝澶氱畝鍗曠殑紼嬪簭map銆乻et閮界敤涓婁簡…… 浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< vector > #include< string > #include< map > #include< algorithm > #include< cstdio > #include< cctype > using namespace std; int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ multimap< string , string > r; string t; while (cin >> t && t != " # " ) { string t_copy(t); for ( int i = 0 ;i < t_copy.size();i ++ ) t_copy[i] = tolower(t_copy[i]); sort(t_copy.begin(),t_copy.end()); r.insert(make_pair(t_copy,t)); } vector < string > ans; for (multimap < string , string > ::iterator i = r.begin();i != r.end();i ++ ) if (r.count(i -> first) == 1 ) ans.push_back(i -> second); sort(ans.begin(),ans.end()); for ( int i = 0 ;i < ans.size();i ++ ) cout << ans[i] << endl; return 0 ; }
]]> UVa 10420 List of Conquests http://m.shnenglu.com/rakerichard/archive/2011/04/08/143774.htmllee1r lee1r Fri, 08 Apr 2011 15:35:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/08/143774.html http://m.shnenglu.com/rakerichard/comments/143774.html http://m.shnenglu.com/rakerichard/archive/2011/04/08/143774.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143774.html http://m.shnenglu.com/rakerichard/services/trackbacks/143774.html 濂沖浠殑鍚嶅瓧娌℃湁浠涔堢敤錛岀敤map<string,int>瀵硅薄璁板綍姣忎釜鍥藉鍑虹幇鐨勬鏁板嵆鍙?br>浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < iostream > #include< string > #include< map > #include< cstdio > using namespace std; const int kMaxn( 2007 ); int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ int n; cin >> n; map < string , int > r; for ( int i = 1 ;i <= n;i ++ ) { string country,t; cin >> country; r[country] ++ ; getchar(); getline(cin,t); } for (map < string , int > ::iterator i = r.begin();i != r.end();i ++ ) cout << i -> first << " " << i -> second << endl; return 0 ; }
]]> UVa 299 Train Swapping http://m.shnenglu.com/rakerichard/archive/2011/04/08/143771.htmllee1r lee1r Fri, 08 Apr 2011 14:58:00 GMT http://m.shnenglu.com/rakerichard/archive/2011/04/08/143771.html http://m.shnenglu.com/rakerichard/comments/143771.html http://m.shnenglu.com/rakerichard/archive/2011/04/08/143771.html#Feedback 0 http://m.shnenglu.com/rakerichard/comments/commentRss/143771.html http://m.shnenglu.com/rakerichard/services/trackbacks/143771.html 鍐掓場鎺掑簭錛屽茍璁板綍浜ゆ崲嬈℃暟銆?br>浠ヤ笅鏄垜鐨勪唬鐮侊細
#include < algorithm > #include< cstdio > using namespace std; const int kMaxn( 57 ); int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ int T; scanf( " %d " , & T); while (T -- ) { int n; scanf( " %d " , & n); int r[kMaxn]; for ( int i = 1 ;i <= n;i ++ ) scanf( " %d " , & r[i]); int ans( 0 ); for ( int i = n;i >= 2 ;i -- ) for ( int j = 1 ;j < i;j ++ ) if (r[j] > r[j + 1 ]) { swap(r[j],r[j + 1 ]); ans ++ ; } printf( " Optimal train swapping takes %d swaps.\n " ,ans); } return 0 ; }
]]>
午夜视频久久久久一区
|
久久久久亚洲AV无码麻豆 |
久久国产三级无码一区二区 |
国产精品美女久久久m |
狠狠色噜噜色狠狠狠综合久久 |
青青久久精品国产免费看 |
91久久精品视频 |
国产亚洲精久久久久久无码AV |
四虎国产精品免费久久久 |
色综合久久最新中文字幕 |
51久久夜色精品国产 |
婷婷综合久久中文字幕 |
91性高湖久久久久 |
久久午夜福利电影 |
精品熟女少妇AV免费久久 |
一本久久a久久精品亚洲 |
日本人妻丰满熟妇久久久久久 |
久久国产精品77777 |
国内精品久久久久久野外 |
91精品国产91久久久久久青草 |
精品久久久久久无码人妻热 |
亚洲精品tv久久久久 |
亚洲va久久久噜噜噜久久男同 |
亚洲精品乱码久久久久久蜜桃不卡 |
无码人妻精品一区二区三区久久久 |
亚洲AV无码成人网站久久精品大 |
国内精品久久久久影院一蜜桃
|
亚洲欧美精品伊人久久 |
日韩一区二区三区视频久久 |
国产A三级久久精品 |
久久香蕉国产线看观看乱码 |
久久一区二区免费播放 |
久久精品中文闷骚内射 |
久久久久国色AV免费看图片 |
亚洲午夜无码久久久久 |
久久久久综合中文字幕 |
av午夜福利一片免费看久久 |
久久亚洲国产成人精品无码区 |
热re99久久精品国99热 |
天天影视色香欲综合久久 |
国产成人精品久久免费动漫 |