这两天主要就是复习一下学的知识点,然后就是刷刷CF1800的题目。让后总结一下。
CF刷题方面:
其中有一个题目比较简单但是细节是真的多,搞老火了,一直错W4主要是不知道错在哪里,什么错误都有:
有点不理解哪里有问题,但是我这个写法确实不是最好的,很容易出错,感觉下次在写之之前需要花更多的时间来优化之后在写!!!!
#include <bits/stdc++.h>
#define OST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl "\n"
#define ll long long
using namespace std;
void solve() {
ll n, k, x;
cin >> n >> k >> x;
string s;
cin >> s;
int cnt = 0;
vector<ll> a;
for (int i = 0; i < n; i ++) {
if (s[i] == '*') {
cnt ++;
} else {
if (cnt)
a.push_back(cnt);
cnt = 0;
}
}
if (cnt) a.push_back(cnt);
// for (auto x : a) cout << x << " ";
// cout << endl;
int len = a.size();
vector<ll> ji(len, 0);
for (int i = len - 1; i >= 0; i --) {
if (i == len - 1) {
ji[i] = 1;
continue;
} else {
// if (i + 1 >= ji.size()) continue;
if (ji[i] >= x) {
break;
}
ji[i] = 1ll * ji[i + 1] * (a[i + 1] * k + 1);
}
}
// for (auto tmp : ji) cout << tmp << ' ';
// cout << endl;
vector<ll> ans(len, 0);
int now = 0;
x --;
while (x && now < (int)ji.size()) {
// cout << ji[now] << endl;
if (now < (int)ji.size() && ji[now] > 0) {
ans[now] = x / ji[now];
x %= ji[now];
}
now ++;
}
// for (auto tmp : ans) cout << tmp << " ";
// cout << endl;
string str = "";
cnt = 0;
int flag = 1;
for (int i = 0; i < n; i ++) {
if (s[i] == '*' && flag) {
// cout << ans[cnt] << endl;
for (int j = 1; j <= ans[cnt]; j ++) {
str += 'b';
}
flag = 0;
if (cnt < (int)ans.size() - 1)
cnt ++;
} else if (s[i] == 'a') {
str += 'a';
flag = 1;
}
}
cout << str << endl;
}
signed main() {
int T = 1;
cin >> T;
while (T--) { solve(); }
return 0;
}
然后就是复习一下计算几何的东西,这一次主要是整理一下这方面的知识,前面学的太片面了就是知识针对题目去搞的,这一次的话就是按照oi-wiki上面的知识点把认为有需要的在去学习一下,然后整理一下这方面的模板,方便使用。主要的话重点还是凸包的其他的话就是一些计算几何的基础,最重要的还是思维能力还有建模的过程。这方面的话思维是一直在练习中,建模的话训练的比较少。然后这几天把计算几何的基础还有前置知识点全复习了一遍,主要就是用的少,上次刚看又忘记了,还是要多用!!!!