From 0b863a7ccf570514db3af7249e32c5e54dd0e07d Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 20 Dec 2020 18:36:12 +0800 Subject: [PATCH] =?UTF-8?q?38793=20=E7=AC=AC=E4=B8=89=E5=B1=8A=E2=80=9C?= =?UTF-8?q?=E4=BC=A0=E6=99=BA=E6=9D=AF=E2=80=9D=E5=85=A8=E5=9B=BD=E5=A4=A7?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AE=A1=E7=AE=97=E6=9C=BA=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=EF=BC=88=E5=88=9D=E8=B5=9B=E5=90=8C=E6=AD=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit T160507: R43986442 T160508: R44005001 T160509: R44020690 --- contest/38793/T160507/T160507.cpp | 14 ++++++++++++++ contest/38793/T160508/T160508.cpp | 28 ++++++++++++++++++++++++++++ contest/38793/T160509/T160509.cpp | 26 ++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 contest/38793/T160507/T160507.cpp create mode 100644 contest/38793/T160508/T160508.cpp create mode 100644 contest/38793/T160509/T160509.cpp diff --git a/contest/38793/T160507/T160507.cpp b/contest/38793/T160507/T160507.cpp new file mode 100644 index 00000000..18725db7 --- /dev/null +++ b/contest/38793/T160507/T160507.cpp @@ -0,0 +1,14 @@ +#include + +using namespace std; + +int main() { + int n, m, v, a, ans = 0; + cin >> n >> v >> m >> a; + for (int i = 1; i <= n; i++) { + ans += v; + if (i % m == 0) v += a; + } + cout << ans << endl; + return 0; +} diff --git a/contest/38793/T160508/T160508.cpp b/contest/38793/T160508/T160508.cpp new file mode 100644 index 00000000..7cc4901e --- /dev/null +++ b/contest/38793/T160508/T160508.cpp @@ -0,0 +1,28 @@ +#include + +using namespace std; + +int main() { + int score; + double gpa = 0.0; + cin >> score; + if (score >= 90) { + gpa = 4.0; + } + else if (60 <= score && score <= 89) { + gpa = 4.0 - (90 - score) * 0.1; + } + else { + if (floor(sqrt(score) * 10.0) >= 90.0) { + gpa = 4.0; + } + else if (floor(sqrt(score) * 10.0) >= 60.0) { + gpa = 4.0 - (90.0 - floor(sqrt(score) * 10.0)) * 0.1; + } + else { + gpa = 0.0; + } + } + cout << fixed << setprecision(1) << gpa << endl; + return 0; +} diff --git a/contest/38793/T160509/T160509.cpp b/contest/38793/T160509/T160509.cpp new file mode 100644 index 00000000..8f12cde8 --- /dev/null +++ b/contest/38793/T160509/T160509.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +struct node { + int i, t, k; +} p[500005]; + +bool cmp(node a, node b) { + return a.t * a.k == b.t * b.k ? a.t == b.t ? a.i < b.i : a.t > b.t : a.t * a.k > b.t * b.k; +} + +int main() { + int n; + cin >> n; + for (int i = 1; i <= n; i++) { + cin >> p[i].t >> p[i].k; + p[i].i = i; + } + sort(p + 1, p + 1 + n, cmp); + for (int i = 1; i <= n; i++) { + cout << p[i].i << ' '; + } + cout << endl; + return 0; +}