Educational Codeforces Round 68 (Rated for Div. 2) C

  • 题目大意: 给出字符串\(s,t,p\),可以从\(p\)中任意取字符加入\(s\)中,问经过某些操作能否将\(p\)变成\(s\)
  • 思路: 因为\(s,t\)中字符的相对位置不可以改变,从前到后对\(t\)\(s\)当前首位或\(p\)中任意一位对其进行匹配,贪心先用\(s\)的首位匹配. 如果匹配完成且\(t\)完全使用则可以匹配.
#include
#include
#include
#include
#include
#include
#include
#define ll long long 
#define FOR(i,n) for(int i =1; i <= n;++i ) 
#define FOR0(i,n) for(int i =0; i < n;++i )  
#define ALL(ve) ve.begin(),ve.end() 
#define inf 0x3f3f3f3f
using namespace std; 
 
int T;
deque s;
deque t;
int cntCh[28];
int main(){
    cin >> T;
    while(T--){
        memset(cntCh,0,sizeof(cntCh));
        s.clear();
        t.clear();
        string buf;
        cin >> buf;
        for(int i=0;i> buf;
        for(int i=0;i> buf;
        for(int i=0;i

现在菜到只会写C了TAT

转载于:https://www.cnblogs.com/xxrlz/p/11188026.html

你可能感兴趣的:(Educational Codeforces Round 68 (Rated for Div. 2) C)