aboutsummaryrefslogtreecommitdiff
path: root/works/life/chuanzhi-cup/contest/2.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-24 00:36:15 +0800
committercrupest <crupest@outlook.com>2021-02-24 00:36:15 +0800
commit90375859767eb4cae3a7a93c64725b504d7f0fe0 (patch)
treef8fcda952bbd2bbd9a6d9a2a2dfad1cb99d5d624 /works/life/chuanzhi-cup/contest/2.cpp
parent93b0dad49c78c22cda374239eda5a77baeb358b1 (diff)
downloadcrupest-90375859767eb4cae3a7a93c64725b504d7f0fe0.tar.gz
crupest-90375859767eb4cae3a7a93c64725b504d7f0fe0.tar.bz2
crupest-90375859767eb4cae3a7a93c64725b504d7f0fe0.zip
import(life): Add chuanzhi-cup codes.
Diffstat (limited to 'works/life/chuanzhi-cup/contest/2.cpp')
-rw-r--r--works/life/chuanzhi-cup/contest/2.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/works/life/chuanzhi-cup/contest/2.cpp b/works/life/chuanzhi-cup/contest/2.cpp
new file mode 100644
index 0000000..358e7fc
--- /dev/null
+++ b/works/life/chuanzhi-cup/contest/2.cpp
@@ -0,0 +1,28 @@
+#include <cmath>
+#include <cstdio>
+
+int main() {
+ int x;
+ std::scanf("%d", &x);
+
+ double gpa;
+
+ if (x >= 90)
+ gpa = 4.0;
+ else if (x >= 60) {
+ gpa = (x - 50.0) / 10.0;
+ } else {
+ int s = std::floor(std::sqrt(x) * 10.0);
+ if (s >= 90)
+ gpa = 4.0;
+ else if (s >= 60) {
+ gpa = (s - 50.0) / 10.0;
+ } else {
+ gpa = 0;
+ }
+ }
+
+ std::printf("%.1f", gpa);
+
+ return 0;
+} \ No newline at end of file