發表文章

目前顯示的是有「字串排列」標籤的文章

UVa 195 Anagram

解題:使用STL next_permutaion & 自建比較排序 Code:  1  #include<cstdio>  2  #include<cstdlib>  3  #include<iostream>  4  #include<algorithm>  5  #include<cctype>  6  #include<cstring>  7  using namespace std ;  8  bool cmp ( char a , char b )  9  { 10      char la = a , lb = b ; 11      la = tolower ( la ), lb = tolower ( b ); 12      if ( la == lb ) 13      { 14          return a < b ; 15      } 16      else return la < lb ; 17  } 18  int main () 19  { 20      int cas ; 21      while ( cin >> cas ) 22      { 23   ...