From 304c15673e68f2493c947fee83df44d1cdea1414 Mon Sep 17 00:00:00 2001 From: TooYoungTooSimp <6648049+TooYoungTooSimp@users.noreply.github.com> Date: Mon, 19 Dec 2016 11:58:20 +0800 Subject: [PATCH] =?UTF-8?q?bzoj=202005=202173=202659=20=EF=BC=88=E6=95=B0?= =?UTF-8?q?=E5=AD=A6=E9=A2=98=E7=9C=9F=E6=98=AF=E8=A7=81=E9=AC=BC=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E6=8A=84=E5=AE=8C=E9=A2=98=E8=A7=A3=E5=B0=B1=E5=BF=98?= =?UTF-8?q?=E4=BA=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OnlineJudges/lydsy/2005.cpp | 18 ++++++++++++++++++ OnlineJudges/lydsy/2173.cpp | 12 ++++++++++++ OnlineJudges/lydsy/2659.cpp | 9 +++++++++ 3 files changed, 39 insertions(+) create mode 100644 OnlineJudges/lydsy/2005.cpp create mode 100644 OnlineJudges/lydsy/2173.cpp create mode 100644 OnlineJudges/lydsy/2659.cpp diff --git a/OnlineJudges/lydsy/2005.cpp b/OnlineJudges/lydsy/2005.cpp new file mode 100644 index 0000000..43fcf5a --- /dev/null +++ b/OnlineJudges/lydsy/2005.cpp @@ -0,0 +1,18 @@ +//http://blog.csdn.net/popoqqq/article/details/39924877 +#include +long long f[100100], ans; +int main() +{ + int m, n, k; + scanf("%d%d", &m, &n); + k = (m < n ? m : n); + for (int i = k; i; i--) + { + f[i] = 1ll * (m / i) * (n / i); + for (int j = 2; j * i <= k; j++) + f[i] -= f[i * j]; + ans += f[i] * (i + i - 1); + } + printf("%lld", ans); + return 0; +} \ No newline at end of file diff --git a/OnlineJudges/lydsy/2173.cpp b/OnlineJudges/lydsy/2173.cpp new file mode 100644 index 0000000..f50984e --- /dev/null +++ b/OnlineJudges/lydsy/2173.cpp @@ -0,0 +1,12 @@ +#include +long long f[4]; +int main() +{ + f[1] = 1; + int n; + scanf("%d", &n); + for (int i = 2; i <= n; i++) + f[i & 3] = ((f[(i - 1) & 3] << 1) + f[(i - 2) & 3]) % 1000000007; + printf("%lld", f[n & 3]); + return 0; +} \ No newline at end of file diff --git a/OnlineJudges/lydsy/2659.cpp b/OnlineJudges/lydsy/2659.cpp new file mode 100644 index 0000000..c5d0f99 --- /dev/null +++ b/OnlineJudges/lydsy/2659.cpp @@ -0,0 +1,9 @@ +//http://www.cnblogs.com/iwtwiioi/p/4985747.html +#include +int main() +{ + int p, q; + scanf("%d%d", &p, &q); + printf("%lld", 1ll * (q - 1) * (p - 1) / 4 + (p == q) * (q - 1) / 2); + return 0; +} \ No newline at end of file