Sat, 03 Aug 2019 21:09:03 +0800

master
大蒟蒻 6 years ago
parent 43c21f3984
commit d0492767a2

@ -0,0 +1,22 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"D:\\PortableApps\\MSYS2\\mingw64\\include\\c++\\9.1.0\\x86_64-w64-mingw32"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}

@ -0,0 +1,20 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "cl.exe build and debug active file",
"type": "cppvsdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "cl.exe build active file"
}
]
}

@ -0,0 +1,18 @@
{
"tasks": [
{
"type": "shell",
"label": "cl.exe build active file",
"command": "cl.exe",
"args": [
"/ID:\\PortableApps\\MSYS2\\mingw64\\include\\c++\\9.1.0\\x86_64-w64-mingw32",
"/Zi",
"/EHsc",
"/Fe:",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}"
]
}
],
"version": "2.0.0"
}

@ -0,0 +1,36 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
const int N = 2050;
char s[N], mp[28];
int cnt[128];
int main()
{
int T, n;
scanf("%d", &T);
for (int t = 1; t <= T; t++)
{
printf("Case #%d: ", t);
CLR(cnt), n = 0;
scanf("%s%s", s, mp);
for (char *p = s; *p; p++, n++)
cnt[mp[*p - 'a']]++;
if (cnt['h'] * 4 >= n)
puts("Harmful");
else if (cnt['h'] * 10 <= n)
puts("Recyclable");
else if (cnt['d'] >= cnt['w'] * 2)
puts("Dry");
else
puts("Wet");
}
return 0;
}

Binary file not shown.

@ -0,0 +1,71 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
char s[129];
int a[8];
int main()
{
set<string> S;
int T;
scanf("%d", &T);
for (int t = 1; t <= T; t++)
{
CLR(a), scanf("%s", s);
printf("Case #%d: ", t);
for (int i = 0; i < 8; i++)
for (int j = 0; j < 16; j++)
a[i] = a[i] << 1 | (s[i << 4 | j] - '0');
//for (int i = 0; i < 8; i++) printf("%x%c", a[i], ":\n"[i == 7]);
//for (int i = 0; i < 8; i++) scanf("%x", a + i);
S.clear();
string str;
for (int len = 8; len >= 2; len--)
{
int pos = -1;
for (int st = 7; st - len + 1 >= 0; st--)
if (all_of(a + st - len + 1, a + st + 1, [](int x) { return x == 0; }))
{
pos = st - len + 1;
str.clear();
for (int i = 0; i < pos; i++)
{
sprintf(s, "%x", a[i]), str += s;
if (i < 7) str += ':';
}
if (pos == 0) str += ':';
for (int i = pos + len; i < 8; i++)
{
if (i) str += ':';
sprintf(s, "%x", a[i]), str += s;
}
if (pos + len == 8) str += ':';
S.insert(str);
}
if (!S.empty()) break;
}
if (!S.empty())
{
//cout << *S.begin() << endl;
int ml = 0x3f3f3f3f;
for (auto &s : S) ml = min(ml, (int)s.size());
for (auto &s : S)
if (s.size() == ml)
{
cout << s << endl;
break;
}
}
else
for (int i = 0; i < 8; i++)
printf("%x%c", a[i], ":\n"[i == 7]);
}
return 0;
}

@ -0,0 +1,8 @@
from random import *
T = 20000
arr = ['0'] * 112 + ['1'] * 16
print(T)
for _ in range(T):
shuffle(arr)
print("".join(arr))
# print("".join(str(randint(0,1)) for _ in range(128)))

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,117 @@
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
char s[200];
int bula[10][10]; //8*4
bool is0[10];
struct sq
{
int l, r;
int leng;
} q[10];
int cnt = 0;
bool cmp(const sq &a, const sq &b)
{
if (a.leng == b.leng)
return a.l > b.l;
else
return a.leng > b.leng;
}
int main()
{
int T;
scanf("%d", &T);
for (int cas = 1; cas <= T; cas++)
{
CLR(s), CLR(bula), CLR(is0), CLR(q), cnt = 0;
scanf("%s", s + 1);
printf("Case #%d: ", cas);
cnt = 0;
memset(is0, 0, sizeof(is0));
int cur = 1;
for (int i = 1; i <= 8; i++)
{
bool zero = 1;
for (int pos = 1; pos <= 4; pos++)
{
int chua = 0;
for (int ka = 3; ka >= 0; ka--)
{
int thisbit = s[cur++] - '0';
if (thisbit) chua ^= (thisbit << ka);
}
bula[i][pos] = chua;
if (chua) zero = 0;
}
if (zero) is0[i] = 1;
}
/* for(int i=1;i<=8;i++,cout<<":"){
for(int j=1;j<=4;j++)cout<<bula[i][j];
}
puts("");*/
bool con = 0;
for (int i = 1; i <= 8; i++)
{
if (is0[i] && (!con))
{
cnt++;
q[cnt].l = i;
con = 1;
}
else if (is0[i] && con)
{
q[cnt].r = i;
}
else
{
con = 0;
}
}
for (int i = 1; i <= cnt; i++) q[i].leng = q[i].r - q[i].l + 1;
sort(q + 1, q + 1 + cnt, cmp);
bool cg = 1;
if (cnt < 1 || q[1].leng == 1) cg = 0;
//if(cg&&q[1].l==1&&q[1].r==8){printf("::\n");continue;}
for (int i = 1; i <= 8; i++)
{
if (cg)
{
if (q[1].l <= i && i <= q[1].r)
{
if (i == 1 || i == q[1].r) printf(":");
continue;
}
}
bool isfirst = 1;
for (int j = 1; j <= 4; j++)
{
if (is0[i])
{
printf("0");
break;
}
else if (bula[i][j] <= 9)
{
if (bula[i][j] == 0 && isfirst)
continue;
else
{
printf("%d", bula[i][j]);
isfirst = 0;
}
}
else
{
putchar('a' + bula[i][j] - 10);
isfirst = 0;
}
}
if (i != 8) printf(":");
}
puts("");
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
add_compile_options("/Zc:__cplusplus")
endif()
include_directories("D:\\PortableApps\\MSYS2\\mingw64\\include\\c++\\9.1.0\\x86_64-w64-mingw32")
add_executable(A A.cpp)
add_executable(B B.cpp)
add_executable(C C.cpp)
add_executable(D D.cpp)
add_executable(E E.cpp)
add_executable(F F.cpp)
add_executable(G G.cpp)
add_executable(H H.cpp)
add_executable(I I.cpp)
add_executable(J J.cpp)
add_executable(K K.cpp)
add_executable(L L.cpp)

@ -0,0 +1,59 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int a[1050];
int calc(int n, int V)
{
int c = 0, r = 0;
multiset<int> S{a, a + n};
while (!S.empty())
{
auto ite = S.upper_bound(r);
if (ite == S.begin()) c++, r = V, ite = S.upper_bound(r);
r -= *--ite;
S.erase(ite);
}
return c;
}
int main()
{
int T, n, K;
scanf("%d", &T);
for (int t = 1; t <= T; t++)
{
scanf("%d%d", &n, &K);
for (int i = 0; i < n; i++)
scanf("%d", a + i);
sort(a, a + n, greater<int>());
int L = a[0], R = a[0] * n + 1, M = L;
while (L < R - 1)
{
M = (L + R) >> 1;
if (calc(n, M) <= K)
R = M;
else
L = M;
}
//if (calc(n, M = L) > K) M = L + 1;
int flag = 1;
for (int st = max(a[0], M - 100);; st++)
if (calc(n, st) <= K)
{
printf("Case #%d: %d\n", t, st);
flag = 0;
break;
}
if (flag)
for (;;)
;
}
return 0;
}

@ -0,0 +1,42 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
const int N = 2005;
char G[N][N];
int mp[N];
int main()
{
int T, n;
scanf("%d", &T);
for (int t = 1; t <= T; t++)
{
scanf("%d", &n);
printf("Case #%d: ", t);
if (n * (n - 1) & 3)
puts("No");
else
{
puts("Yes");
FIL(G, '0');
for (int i = 1; i < n; i += 3)
for (int j = 0; i + j < n; j++)
G[j][i + j] = '1';
for (int i = 1; i < n; i += 3)
for (int j = 0; i + j < n; j++)
G[i + j][j] = '1';
for (int i = 0; i + i < n; i++) mp[i] = (i + 1) << 1;
for (int i = n / 2; i < n; i++) mp[i] = (i - n / 2) << 1 | 1;
for (int i = 0; i < n; i++) G[i][n] = 0, puts(G[i]);
for (int i = 0; i < n; i++) printf("%d%c", mp[i], " \n"[i == n - 1]);
}
}
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

@ -0,0 +1,15 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
int main()
{
return 0;
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save