牛客IOI周赛23-普及组
作者:互联网
牛客IOI周赛23-普及组
小L的作文
/*
*@author SunLakeWalk
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <limits.h>
#include <sstream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
//#pragma GCC optimize(2)
//#pragma GCC optimize(3, "Ofast", "inlin")
using namespace std;
#define ios ios::sync_with_stdio(false) , cin.tie(0)
#define x first
#define y second
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int N = 100010, INF = 0x3f3f3f3f, mod = 1e9 + 7, base = 131;
const double eps = 1e-6, PI = acos(-1);
char c;
string s;
int ans;
void work() {
cin >> c;
cin >> s;
for (int i = 0; i < s.size(); i ++ )
if (s[i] == c) ans ++;
cout << ans << endl;
}
int main() {
int T = 1;
// cin >> T;
while (T -- ) {
work();
}
return 0;
}
C小L的编辑器
双链表
/*
*@author SunLakeWalk
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <limits.h>
#include <sstream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
//#pragma GCC optimize(2)
//#pragma GCC optimize(3, "Ofast", "inlin")
using namespace std;
#define ios ios::sync_with_stdio(false) , cin.tie(0)
#define x first
#define y second
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int N = 1000010, INF = 0x3f3f3f3f, mod = 1e9 + 7, base = 131;
const double eps = 1e-6, PI = acos(-1);
/*
链表啊
*/
char s[N], t[N];
int l[N], r[N], idx;
char e[N];
void insert(int k, char c) {
e[idx] = c;
l[idx] = k, r[idx] = r[k];
l[r[k]] = idx, r[k] = idx;
idx ++;
}
void work() {
cin >> s + 1 >> t + 1;
int n = strlen(s + 1);
r[0] = 1, l[1] = 0;
idx = 2;
for (int i = 1; i <= n; i ++ ) {
if (t[i - 1] == 'L') {
insert(l[i], s[i]);
}
else if (t[i - 1] == 'R'){
insert(i, s[i]);
}
else {
insert(0, s[i]);
}
}
for (int i = r[0]; i != 1; i = r[i] ) cout << e[i];
cout << endl;
}
int main() {
int T = 1;
// cin >> T;
while (T -- ) {
work();
}
return 0;
}
标签:typedef,idx,23,int,cin,long,牛客,IOI,include 来源: https://blog.csdn.net/qq_37978559/article/details/114779098