Finish: Luogu Beginer Conest(Feb)

This commit is contained in:
Frederick Chen 2025-02-14 13:13:39 +00:00
parent 377cd93809
commit cd79a24351
6 changed files with 175 additions and 1 deletions

3
.gitignore vendored
View File

@ -53,4 +53,5 @@ dkms.conf
# config # config
fame.cpp fame.cpp
.cph/ .cph/
.vscode/

View File

@ -0,0 +1,27 @@
#include <bits/stdc++.h>
#define lo long long
#define INF INT_MAX
#define LLM LONG_LONG_MAX
using namespace std;
const lo N = 1e7 + 10;
/*
toothless. #17
@fredcss_dev
*/
signed main() {
lo n, x, y;
cin >> n >> x >> y;
lo cw = (y - x + n) % n;
lo cnt = n - cw;
if (cw < cnt) {
cout << "Clockwise Loop" << endl;
} else if (cw > cnt) {
cout << "Counter-clockwise Loop" << endl;
} else {
cout << "\"Wonderful\"" << endl;
}
return 0;
}

View File

@ -0,0 +1,37 @@
#include <bits/stdc++.h>
#define lo long long
#define INF INT_MAX
#define LLM LONG_LONG_MAX
using namespace std;
const int N = 1e7 + 10;
/*
toothless. #17
@fredcss_dev
*/
signed main() {
int X, Y, K;
cin >> X >> Y >> K;
int mx = -1;
int count = 0;
for (int b = 0; b <= X; ++b) {
for (int p = 1; p <= Y; ++p) {
for (int z = 0; z <= K; ++z) {
int d = (b + p) ^ z;
if (d > mx) {
mx = d;
count = 1;
} else if (d == mx) {
++count;
}
}
}
}
cout << mx << endl;
cout << count << endl;
return 0;
}

View File

@ -0,0 +1,58 @@
#include <bits/stdc++.h>
#define lo long long
#define INF INT_MAX
#define LLM LONG_LONG_MAX
using namespace std;
const int N = 1e7 + 10;
/*
toothless. #17
@fredcss_dev
*/
int f(int n, int k, vector<int>& a) {
// 初始胜场数计算
int red = 0, pink = 0;
for (int ai : a) {
if (ai > 49) {
red++;
} else {
pink++;
}
}
int cnt = 0;
for (int l = 0; l <= n - k; l++) {
int chr = 0, cpi = 0;
for (int i = l; i < l + k; i++) {
bool ysfred = (a[i] > 49);
int tzhred = a[i] - 2;
int tzhpink = 101 - a[i];
bool tzhredWin = (tzhred > tzhpink);
if (ysfred && !tzhredWin) {
chr--;
cpi++;
} else if (!ysfred && tzhredWin) {
chr++;
cpi--;
}
}
int nre = red + chr;
int npi = pink + cpi;
if (npi > nre) {
cnt++;
}
}
return cnt;
}
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int result = f(n, k, a);
cout << result << endl;
return 0;
}

View File

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
#define lo long long
#define INF INT_MAX
#define LLM LONG_LONG_MAX
using namespace std;
const lo N = 1e7 + 10;
/*
toothless. #17
@fredcss_dev
*/
signed main() {
lo V_egg, V_milk, V_tart;
lo e, m, t;
cin >> V_egg >> V_milk >> V_tart;
cin >> e >> m >> t;
lo total_volume = V_egg * e + V_milk * m;
lo num_tarts = (total_volume + V_tart - 1) / V_tart;
lo batches = (num_tarts + t - 1) / t;
cout << batches << endl;
return 0;
}

View File

@ -0,0 +1,28 @@
#include <bits/stdc++.h>
#define lo long long
#define INF INT_MAX
#define LLM LONG_LONG_MAX
using namespace std;
const lo N = 1e7 + 10;
/*
toothless. #17
@fredcss_dev
*/
signed main() {
lo n, L, R;
cin >> n >> L >> R;
lo S = L;
lo k = S / n;
lo r = S % n;
vector<lo> ans(n, k);
for (lo i = 0; i < r; ++i) {
ans[i] += 1;
}
for (lo i = 0; i < n; ++i) {
cout << ans[i] << " ";
}
cout << endl;
return 0;
}