From db3c85389325fe18c19287dc4747a5641ef73169 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 12 Sep 2022 21:35:38 +0800 Subject: [PATCH] =?UTF-8?q?1995=20-=20=E6=9A=97=E5=BD=B1=E5=B2=9B=E7=9A=84?= =?UTF-8?q?=E6=AD=8C=E5=A3=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 77471 --- bjtu/1995/1995.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bjtu/1995/1995.cpp diff --git a/bjtu/1995/1995.cpp b/bjtu/1995/1995.cpp new file mode 100644 index 00000000..d3411789 --- /dev/null +++ b/bjtu/1995/1995.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const double d[] = {0, 261.6, 293.6, 329.6, 349.2, 392.0, 440.0, 493.8}; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + std::string s; + double ans = 0; + + cin >> s; + + for (int i = 1; i < s.size(); i++) { + if (s[i] == '-') s[i] = s[i - 1]; + } + + for (char c : s) { + ans += d[c - '0']; + } + + cout << std::fixed << std::setprecision(6) << ans / s.size() << endl; + + return 0; +}