Test instructions: give you a string and a character conversion rule, ask you what the string looks like after you put it.
The idea of solving problems: vector simulation Mapping
Problem Solving Code:
1 //File name:a.cpp2 //Author:darkdream3 //Created time:2015 April 04 Saturday 13:39 13 seconds4 5#include <vector>6#include <list>7#include <map>8#include <Set>9#include <deque>Ten#include <stack> One#include <bitset> A#include <algorithm> -#include <functional> -#include <numeric> the#include <utility> -#include <sstream> -#include <iostream> -#include <iomanip> +#include <cstdio> -#include <cmath> +#include <cstdlib> A#include <cstring> at#include <ctime> - #defineLL Long Long - - using namespacestd; - intT; - intfa[ +]; invector<int> mp[ -]; - Charstr[1000005]; to Charstr1[Ten]; + Charstr2[Ten]; - intMain () { thescanf"%d",&t); * while(t--) $ {Panax Notoginsengscanf"%s", str); - intLen =strlen (str); the for(inti =1; I <=299; i + +) + Mp[i].push_back (i); A intQ; thescanf"%d",&q); + for(inti =1; I <= Q;i + +) - { $scanf"%s%s", STR1,STR2); $ intTA = str1[0]; - intTB = str2[0]; - for(inti =0; i < mp[tb].size (); i + +) the Mp[ta].push_back (Mp[tb][i]); - mp[tb].clear ();Wuyi } the //printf ("***\n"); - for(inti =1; I <=299; i + +) Wu { - for(intj =0; J < Mp[i].size (); j + +) About { $FA[MP[I][J]] =i; - } - mp[i].clear (); - } A for(inti =0; i < Len; i + +) + { theprintf"%c", Fa[str[i]]); - } $printf"\ n"); the } the the return 0; the}View Code
Regionals Asia-dhaka A mapping