From e128a72a05849448d99c96d86e48aaa8db444b5f Mon Sep 17 00:00:00 2001 From: TooYoungTooSimp <6648049+TooYoungTooSimp@users.noreply.github.com> Date: Sun, 11 Aug 2019 14:50:43 +0800 Subject: [PATCH] Sun, 11 Aug 2019 14:50:43 +0800 --- hdu853/01.cpp | 15 ++++++ hdu853/02.cpp | 15 ++++++ hdu853/03.cpp | 15 ++++++ hdu853/04.cpp | 50 ++++++++++++++++++++ hdu853/05.cpp | 15 ++++++ hdu853/06.cpp | 15 ++++++ hdu853/07.cpp | 15 ++++++ hdu853/08.cpp | 39 ++++++++++++++++ hdu853/09.cpp | 15 ++++++ hdu853/10.cpp | 15 ++++++ hdu853/11.cpp | 15 ++++++ hdu853/12.cpp | 28 +++++++++++ hdu853/CMakeLists.txt | 18 +++++++ nowcoder887/A.cpp | 15 ++++++ nowcoder887/B.cpp | 15 ++++++ nowcoder887/C.cpp | 15 ++++++ nowcoder887/CMakeLists.txt | 17 +++++++ nowcoder887/D.cpp | 15 ++++++ nowcoder887/E | Bin 0 -> 28168 bytes nowcoder887/E.cpp | 93 +++++++++++++++++++++++++++++++++++++ nowcoder887/F.cpp | 15 ++++++ nowcoder887/G.cpp | 15 ++++++ nowcoder887/H.cpp | 32 +++++++++++++ nowcoder887/I.cpp | 15 ++++++ nowcoder887/J.cpp | 37 +++++++++++++++ nowcoder887/K.cpp | 45 ++++++++++++++++++ nowcoder888/A.cpp | 19 ++++++++ nowcoder888/B.cpp | 35 ++++++++++++++ nowcoder888/C.cpp | 34 ++++++++++++++ nowcoder888/CMakeLists.txt | 16 +++++++ nowcoder888/D.cpp | 19 ++++++++ nowcoder888/E.cpp | 48 +++++++++++++++++++ nowcoder888/F.cpp | 19 ++++++++ nowcoder888/G.cpp | 53 +++++++++++++++++++++ nowcoder888/H.cpp | 19 ++++++++ nowcoder888/I.cpp | 19 ++++++++ nowcoder888/J.cpp | 19 ++++++++ 37 files changed, 899 insertions(+) create mode 100644 hdu853/01.cpp create mode 100644 hdu853/02.cpp create mode 100644 hdu853/03.cpp create mode 100644 hdu853/04.cpp create mode 100644 hdu853/05.cpp create mode 100644 hdu853/06.cpp create mode 100644 hdu853/07.cpp create mode 100644 hdu853/08.cpp create mode 100644 hdu853/09.cpp create mode 100644 hdu853/10.cpp create mode 100644 hdu853/11.cpp create mode 100644 hdu853/12.cpp create mode 100644 hdu853/CMakeLists.txt create mode 100644 nowcoder887/A.cpp create mode 100644 nowcoder887/B.cpp create mode 100644 nowcoder887/C.cpp create mode 100644 nowcoder887/CMakeLists.txt create mode 100644 nowcoder887/D.cpp create mode 100644 nowcoder887/E create mode 100644 nowcoder887/E.cpp create mode 100644 nowcoder887/F.cpp create mode 100644 nowcoder887/G.cpp create mode 100644 nowcoder887/H.cpp create mode 100644 nowcoder887/I.cpp create mode 100644 nowcoder887/J.cpp create mode 100644 nowcoder887/K.cpp create mode 100644 nowcoder888/A.cpp create mode 100644 nowcoder888/B.cpp create mode 100644 nowcoder888/C.cpp create mode 100644 nowcoder888/CMakeLists.txt create mode 100644 nowcoder888/D.cpp create mode 100644 nowcoder888/E.cpp create mode 100644 nowcoder888/F.cpp create mode 100644 nowcoder888/G.cpp create mode 100644 nowcoder888/H.cpp create mode 100644 nowcoder888/I.cpp create mode 100644 nowcoder888/J.cpp diff --git a/hdu853/01.cpp b/hdu853/01.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/01.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/02.cpp b/hdu853/02.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/02.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/03.cpp b/hdu853/03.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/03.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/04.cpp b/hdu853/04.cpp new file mode 100644 index 0000000..3973d0d --- /dev/null +++ b/hdu853/04.cpp @@ -0,0 +1,50 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } +struct prob +{ + int a, b; + OPL(prob, rhs) { return a < rhs.a || (a == rhs.a && b > rhs.b); } +}; +int main() +{ + int T, n; + scanf("%d", &T); + while (T--) + { + priority_queue H; + ll hi = 0, lo = 1, g, asum = 0; + scanf("%d", &n); + for (int i = 0; i < n; i++) + { + prob p; + scanf("%d%d", &p.a, &p.b); + if (p.a > p.b) swap(p.a, p.b); + H.push(p); + asum += p.a; + if (i & 1 ^ 1) + { + p = H.top(); + hi = (asum - p.a) * (p.a + p.b) + p.a * p.b; + lo = p.a + p.b; + } + else + { + hi = asum, lo = 1; + } + g = gcd(hi, lo); + hi /= g, lo /= g; + printf("%lld/%lld\n", hi, lo); + } + } + return 0; +} \ No newline at end of file diff --git a/hdu853/05.cpp b/hdu853/05.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/05.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/06.cpp b/hdu853/06.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/06.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/07.cpp b/hdu853/07.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/07.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/08.cpp b/hdu853/08.cpp new file mode 100644 index 0000000..77802af --- /dev/null +++ b/hdu853/08.cpp @@ -0,0 +1,39 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } +ll f(ll n, ll m) +{ + ll x = n; + do + if (gcd(++x, n) == 1) m--; + while (m); + return x; +} +int main() +{ + ll T, k, m; + scanf("%lld", &T); + while (T--) + { + scanf("%lld%lld", &k, &m); + bool flag = true; + for (ll n = 1; n < 10000; n++) + if (((f(n, m) - n) ^ n) == k) + { + printf("%lld\n", n); + flag = false; + break; + } + if (flag) puts("-1"); + } + return 0; +} \ No newline at end of file diff --git a/hdu853/09.cpp b/hdu853/09.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/09.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/10.cpp b/hdu853/10.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/10.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/11.cpp b/hdu853/11.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/hdu853/11.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/hdu853/12.cpp b/hdu853/12.cpp new file mode 100644 index 0000000..31890b4 --- /dev/null +++ b/hdu853/12.cpp @@ -0,0 +1,28 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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 = 1e5 + 50; +int a[N]; +int main() +{ + int T, n; + scanf("%d", &T); + while (T--) + { + scanf("%d", &n); + for (int i = 0; i < n; i++) scanf("%d", a + i); + sort(a, a + n, greater()); + ll cnt[] = {0, 0}; + for (int i = 0; i < n; i++) cnt[i & 1] += a[i]; + printf("%lld %lld\n", cnt[0], cnt[1]); + } + return 0; +} \ No newline at end of file diff --git a/hdu853/CMakeLists.txt b/hdu853/CMakeLists.txt new file mode 100644 index 0000000..ff9cee8 --- /dev/null +++ b/hdu853/CMakeLists.txt @@ -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(01 01.cpp) +add_executable(02 02.cpp) +add_executable(03 03.cpp) +add_executable(04 04.cpp) +add_executable(05 05.cpp) +add_executable(06 06.cpp) +add_executable(07 07.cpp) +add_executable(08 08.cpp) +add_executable(09 09.cpp) +add_executable(10 10.cpp) +add_executable(11 11.cpp) +add_executable(12 12.cpp) diff --git a/nowcoder887/A.cpp b/nowcoder887/A.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/A.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/B.cpp b/nowcoder887/B.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/B.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/C.cpp b/nowcoder887/C.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/C.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/CMakeLists.txt b/nowcoder887/CMakeLists.txt new file mode 100644 index 0000000..766e4de --- /dev/null +++ b/nowcoder887/CMakeLists.txt @@ -0,0 +1,17 @@ +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) diff --git a/nowcoder887/D.cpp b/nowcoder887/D.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/D.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/E b/nowcoder887/E new file mode 100644 index 0000000000000000000000000000000000000000..a5e15b41c216b40be99fa4fadce540626b0d9d78 GIT binary patch literal 28168 zcmeHQ4|rTvm4B0@r65hxLM0TW5el{fA(JL)3e+ZTrhSpL4NZd8wmv2^(`4vmCeEM! zVJQ?-{2W6hC?L4i1!ST7>9WWtd|gFM+d!&zHPz}yL5Uc3N-75YLvRb(-?{hPH}Acf zNxQn=x8Jv49!$==zjN-n=bn4+x%a(!^LmG;adn={rKuxd`;bPZzG8{gGULcrJ^`uK zYP9#@@B6fiwV5av2u$*8B>`6+9eH*-i}8F=s<)r{PI@uRDXJ_aO7(Ib`_GabMK$gR z)tf;qE<5Q9@0IlwReZC(a>>^mbogwED{8GrzS+NA^7pT`)2F!Kh*KI zey*ozG1pU6`ICG?p8@7OX+3y!C`z()H2o&-r}LxSuMA2KAU;!7??%)kJJ0ms?r9si zyCrH5vAExN<&`v6)tX_n zcSgcSEbfiQ4MQ^;TGkr=Ks3-EjKu@dmbI%wk#L~J+ZGB)UUtsM)-}g#f{~cf=8Xj^ z8^XbOz1y>0Gcxg2gu{kT**wnLeLf>bB{$(dWmYg2@hw|s#C+cHR#*uGecKFQ$2McD zHy8ro+vzpD@xabtTS2#&MBB+EoH&a5s3UVZo%JU z!6z*ExfZ;H?WE;IR4pKRgNTHxdj*N4_BzM;MP1^Yr%ObQ%y|MX%9?$ zVA=!I9+>vPvEWKyO&sJ!fepi1yZ*oZQ9+-7l=%1{574YQc zqxf62pcZFT?jYWYkx3kv|D4LSOFS_o%0HqqZJAE=i}LrVOk1TBPl@s&D$^F}#KWTe zO)AsY=tLjNWRLsz4as94*ORa6-J|18Esec1X5#8x@11=QHkW$u@?#L5oOdbe{izSd zdvT)o&iD+GWfSpv=*qhv!a2Hf_T)&>f;|w|4l{+kSIAd=jL715_2jsI@bwk?!HIm` z^`d_4-T3)X@Do-rYjR|3(SrJPeX?)Q^2e_O6Ygy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_Bv6L?i)C$zApZG`pr4_-l?_+Nv8fll4sWbOEA#IPL!YGasN`%9L}T!- ztzdu`4TQW@fzP@^aji_;&@970l7Mp&5@pedxN0j4bnt!E4nOLulB^+bu*w?h9E!c2 zK_6O;Ko|a$i3X%HWB{!U^Qsfqf0;Ls|2Bla4sqdw$1B94o{S0fj;)Hyv>Z|AY6dh+l)xN5)`oEX! zuVgv(yq}_dmiqLSle7M3fss$hK5^jtI4f1p-7+d{Rp&&L_*mGHCT-)J{--p4a`pW<6xdTPj_moPB@}Da2cho;x zE;%M8<(9+Q{`qz0 zUsYex-vYDNH=pOMl~r^}%)hFhqJIF#T3>yytk=pa%1)&~)l=m^c*yqiqMt(qW}$>`IpS+f^$IY97)&rd+4&SNQ{v&zQE$ j8uD*nlcZ(*y{h7=c2$||Q+-z$(dPrQl<%nEC~E%=p^~YF literal 0 HcmV?d00001 diff --git a/nowcoder887/E.cpp b/nowcoder887/E.cpp new file mode 100644 index 0000000..c62b38f --- /dev/null +++ b/nowcoder887/E.cpp @@ -0,0 +1,93 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +const int N = 4e5 + 50; +int X[N], Y[N], mp[N << 1]; +template +struct SegTree +{ +#define L(x) ((x) << 1) +#define R(x) ((x) << 1 | 1) +#define avg(x, y) (((x) + (y)) >> 1) + struct Node + { + ll a, x; + } N[sz << 2]; + void addtag(int k, int l, int r, ll v) + { + N[k].a += v; + N[k].x += (r - l) * v; + } + void pushdown(int k, int l, int r) + { + if (N[k].a == 0) return; + int m = avg(l, r); + addtag(L(k), l, m, N[k].a); + addtag(R(k), m, r, N[k].a); + N[k].a = 0; + } + void modify(int k, int l, int r, int x, int y, ll v) + { + if (x <= l && r <= y) return addtag(k, l, r, v); + int m = avg(l, r); + pushdown(k, l, r); + if (x < m) modify(L(k), l, m, x, y, v); + if (y > m) modify(R(k), m, r, x, y, v); + N[k].x = N[L(k)].x + N[R(k)].x; + } + int kth(int k, int l, int r, int sz) + { + if (l == r - 1) + { + return l; + } + pushdown(k, l, r); + int d = N[L(k)].x, m = avg(l, r); + return d >= k ? kth(L(k), l, m, k) : kth(R(k), m, r, k - d); + } +}; +SegTree st; +int main() +{ + int n; + scanf("%d", &n); + { + ll a, b, c, m; + scanf("%d%d%lld%lld%lld%lld", X, X + 1, &a, &b, &c, &m); + for (int i = 2; i < n; i++) X[i] = (a * X[i - 1] + b * X[i - 2] + c) % m; + scanf("%d%d%lld%lld%lld%lld", Y, Y + 1, &a, &b, &c, &m); + for (int i = 2; i < n; i++) Y[i] = (a * Y[i - 1] + b * Y[i - 2] + c) % m; + for (int i = 0; i < n; i++) + { + if (X[i] > Y[i]) swap(X[i], Y[i]); + X[i]++, Y[i]++; + } + } + memcpy(mp, X, n << 2); + memcpy(mp + n, Y, n << 2); + sort(mp, mp + n + n); + int mpl = unique(mp, mp + n + n) - mp; + for (int i = 0; i < n; i++) X[i] = lower_bound(mp, mp + mpl, X[i]) - mp; + for (int i = 0; i < n; i++) Y[i] = lower_bound(mp, mp + mpl, Y[i]) - mp; + IFD + { + for (int i = 0; i < n; i++) printf("%d%c", mp[X[i]], " \n"[i == n - 1]); + for (int i = 0; i < n; i++) printf("%d%c", mp[Y[i]], " \n"[i == n - 1]); + } + for (int i = 0; i < n; i++) + { + } + return 0; +} \ No newline at end of file diff --git a/nowcoder887/F.cpp b/nowcoder887/F.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/F.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/G.cpp b/nowcoder887/G.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/G.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/H.cpp b/nowcoder887/H.cpp new file mode 100644 index 0000000..8e55521 --- /dev/null +++ b/nowcoder887/H.cpp @@ -0,0 +1,32 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +bitset<32> BM; +int main() +{ + int a, b, c; + while (~scanf("%d%d%d", &a, &b, &c)) + { + long long cnt[] = {0, 0, 0}; + for (int x = 1; x <= a; x++) + for (int y = 1; y <= b; y++) + { + if ((x & y) > c) cnt[0]++; + if ((x ^ y) < c) cnt[1]++; + if ((x & y) > c && (x ^ y) < c) cnt[2]++; + } + cout << (BM = a) << endl; + cout << (BM = b) << endl; + cout << (BM = c) << endl; + printf("%lld : %lld + %lld - %lld\n", cnt[0] + cnt[1] - cnt[2], cnt[0], cnt[1], cnt[2]); + } + return 0; +} \ No newline at end of file diff --git a/nowcoder887/I.cpp b/nowcoder887/I.cpp new file mode 100644 index 0000000..3ee04af --- /dev/null +++ b/nowcoder887/I.cpp @@ -0,0 +1,15 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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; +} \ No newline at end of file diff --git a/nowcoder887/J.cpp b/nowcoder887/J.cpp new file mode 100644 index 0000000..50ff33a --- /dev/null +++ b/nowcoder887/J.cpp @@ -0,0 +1,37 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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 = 1e5 + 50; +ll a[N], b[N], c[N]; +int main() +{ + int n, k; + scanf("%d%d", &n, &k); + for (int i = 0; i < n; i++) scanf("%lld%lld", a + i, b + i); + for (int i = 1; i < n; i++) c[i] = b[i - 1] * a[i]; + ll baseV = accumulate(c, c + n, 0ll); + ll mn = 0, mx = 0, mnt = 0, mxt = 0; + for (int i = 1; i < n; i++) + { + } + mn = min(mn, mnt), mx = max(mx, mxt); + if (k == 0) + printf("%lld", baseV); + else + { + ll cur = baseV; + ll minId = n; + for (int i = n; i; i--) { + } + printf("%lld", cur); + } + return 0; +} \ No newline at end of file diff --git a/nowcoder887/K.cpp b/nowcoder887/K.cpp new file mode 100644 index 0000000..b28f58d --- /dev/null +++ b/nowcoder887/K.cpp @@ -0,0 +1,45 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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 = 1e6 + 50; +bool vis[N]; +int a[N]; +void read(int &x) +{ + int ch = x = 0; + while (!isdigit(ch)) ch = getchar(); + for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0'; +} +int main() +{ + int n, m, q; + read(n), read(m), read(q); + for (int i = 1; i <= n; i++) read(a[i]); + for (int i = 1, x, y; i < m; i++) + { + read(x), read(y); + if (x == y) continue; + vis[x] = true; + } + for (int i = 1; i <= n; i++) + { + if (vis[i]) a[i] = 0; + a[i] += a[i - 1]; + } + ll ans = 0; + for (int i = 1, x, y; i <= q; i++) + { + read(x), read(y); + ans ^= i * (a[y] - a[x - 1]); + } + printf("%lld", ans); + return 0; +} \ No newline at end of file diff --git a/nowcoder888/A.cpp b/nowcoder888/A.cpp new file mode 100644 index 0000000..21a092b --- /dev/null +++ b/nowcoder888/A.cpp @@ -0,0 +1,19 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +int main() +{ + return 0; +} \ No newline at end of file diff --git a/nowcoder888/B.cpp b/nowcoder888/B.cpp new file mode 100644 index 0000000..dd52cf5 --- /dev/null +++ b/nowcoder888/B.cpp @@ -0,0 +1,35 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +const int N = 1e5 + 50; +int n, a[N], cnt[N], last[N]; +int main() +{ + scanf("%d", &n); + for (int i = 1; i <= n; i++) scanf("%d", a + i); + ll ans = 0, cur = 0; + for (ll i = 1; i <= n; i++) + { + cur += cnt[i] = cnt[i - 1]; + if (last[a[i]] == 0) + cnt[i]++; + else + cur -= i - last[a[i]]; + last[a[i]] = i; + ans += i * cnt[i] - cur; + } + printf("%lld", ans); + return 0; +} \ No newline at end of file diff --git a/nowcoder888/C.cpp b/nowcoder888/C.cpp new file mode 100644 index 0000000..8503e70 --- /dev/null +++ b/nowcoder888/C.cpp @@ -0,0 +1,34 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +const int N = 1 << 10 | 1; +int a[N][N]; +int main() +{ + int n; + scanf("%d", &n); + a[0][0] = 1; + for (int c = 1; c < n; c <<= 1) + for (int i = 0; i < c; i++) + for (int j = 0; j < c; j++) + { + a[c + i][j] = a[i][c + j] = a[i][j]; + a[c + i][c + j] = a[i][j] ^ 1; + } + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + printf("%d%c", a[i][j] * 2 - 1, " \n"[j == n - 1]); + return 0; +} \ No newline at end of file diff --git a/nowcoder888/CMakeLists.txt b/nowcoder888/CMakeLists.txt new file mode 100644 index 0000000..45f29f4 --- /dev/null +++ b/nowcoder888/CMakeLists.txt @@ -0,0 +1,16 @@ +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) diff --git a/nowcoder888/D.cpp b/nowcoder888/D.cpp new file mode 100644 index 0000000..21a092b --- /dev/null +++ b/nowcoder888/D.cpp @@ -0,0 +1,19 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +int main() +{ + return 0; +} \ No newline at end of file diff --git a/nowcoder888/E.cpp b/nowcoder888/E.cpp new file mode 100644 index 0000000..2d50125 --- /dev/null +++ b/nowcoder888/E.cpp @@ -0,0 +1,48 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +const int N = 1e5 + 50; +struct Edge +{ + int nxt, to, l, r; +} E[N]; +int adj[N], ecnt; +inline void addEdge(int f, int t, int l, int r) +{ + E[++ecnt] = {adj[f], t, l, r}; + adj[f] = ecnt; +} +bool modify(int u, int v, int l, int r) +{ + return false; +} +int main() +{ + int n, m; + scanf("%d%d", &n, &m); + for (int i = 0, f, t, l, r; i < m; i++) + { + scanf("%d%d%d%d", &f, &t, &l, &r); + addEdge(f, t, l, r); + addEdge(t, f, l, r); + } + queue Q; + static bool inq[N]; + for (Q.push(1), inq[1] = true; !Q.empty(); inq[Q.front()] = false, Q.pop()) + for (int u, e = adj[u = Q.front()]; e; e = E[e].nxt) + if (modify(u, E[e].to, E[e].l, E[e].r) && !inq[E[e].to]) + Q.push(E[e].to), inq[E[e].to] = true; + return 0; +} \ No newline at end of file diff --git a/nowcoder888/F.cpp b/nowcoder888/F.cpp new file mode 100644 index 0000000..21a092b --- /dev/null +++ b/nowcoder888/F.cpp @@ -0,0 +1,19 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +int main() +{ + return 0; +} \ No newline at end of file diff --git a/nowcoder888/G.cpp b/nowcoder888/G.cpp new file mode 100644 index 0000000..0a8ae53 --- /dev/null +++ b/nowcoder888/G.cpp @@ -0,0 +1,53 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +const int N = 1e5 + 50; +char s[N]; +int main() +{ + scanf("%s", s); + int n = strlen(s), ans = 0; + list l(s, s + n); + for (auto ite = l.begin(); ite != l.end();) + { + bool flag = true; + auto ite2 = ite; + ++ite2; + if (ite2 != l.end() && *ite2 == *ite) + { + auto ite3 = ite2; + ++ite3; + if (ite3 != l.end() && *ite3 == *ite) + { + flag = false; + ans++; + if (ite == l.begin()) + { + l.erase(ite, ++ite3); + ite = l.begin(); + } + else + { + l.erase(ite--, ++ite3); + if (ite != l.begin()) --ite; + } + } + } + if (flag && ite != l.end()) + ++ite; + } + printf("%d", ans); + return 0; +} \ No newline at end of file diff --git a/nowcoder888/H.cpp b/nowcoder888/H.cpp new file mode 100644 index 0000000..21a092b --- /dev/null +++ b/nowcoder888/H.cpp @@ -0,0 +1,19 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +int main() +{ + return 0; +} \ No newline at end of file diff --git a/nowcoder888/I.cpp b/nowcoder888/I.cpp new file mode 100644 index 0000000..21a092b --- /dev/null +++ b/nowcoder888/I.cpp @@ -0,0 +1,19 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +int main() +{ + return 0; +} \ No newline at end of file diff --git a/nowcoder888/J.cpp b/nowcoder888/J.cpp new file mode 100644 index 0000000..21a092b --- /dev/null +++ b/nowcoder888/J.cpp @@ -0,0 +1,19 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING +#include +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) +#ifndef _DEBUG +#define _DEBUG 0 +#endif // !_DEBUG +#define IFD if (_DEBUG) +typedef long long ll, i64; +int main() +{ + return 0; +} \ No newline at end of file