0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 19:28:48 +00:00

#929. [2019.10长郡集训day12]古代龙人的谜题(puzzle)

https://sjzezoj.com/submission/55108
This commit is contained in:
Baoshuo Ren 2022-08-20 16:43:17 +08:00
parent eb9b66ed48
commit 21757eb268
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
68 changed files with 249 additions and 0 deletions

48
S2OJ/929/929.cpp Normal file
View File

@ -0,0 +1,48 @@
#include <iostream>
#include <string>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e6 + 5;
int t, n;
int cnt, len[N];
int cnt_odd, cnt_even;
std::string s;
long long ans;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t >> n >> s;
s = ' ' + s;
len[0] = 1;
for (int i = 1; i <= n; i++) {
len[s[i] == '1' ? ++cnt : cnt]++;
}
for (int i = 1; i <= cnt; i++) {
if (i % 2 == 1) {
ans += static_cast<long long>(cnt_even) * len[i];
cnt_even += len[i - 1];
} else {
ans += static_cast<long long>(cnt_odd) * len[i];
cnt_odd += len[i - 1];
}
}
for (int i = 1; i <= cnt; i++) {
if (len[i - 1] > 1 && len[i] > 1) {
ans += static_cast<long long>(len[i - 1] - 1) * (len[i] - 1);
}
}
cout << ans << endl;
return 0;
}

BIN
S2OJ/929/data/ex_puzzle1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/ex_puzzle1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/ex_puzzle2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/ex_puzzle2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/ex_puzzle3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/ex_puzzle3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle15.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle16.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle17.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle18.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle19.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle20.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle21.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle21.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle22.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle22.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle23.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle23.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle24.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle24.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle25.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle25.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle26.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle26.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle27.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle27.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle28.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle28.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle29.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle29.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle30.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle30.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/929/data/puzzle9.out (Stored with Git LFS) Normal file

Binary file not shown.