mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:28:47 +00:00
1995 - 暗影岛的歌声
77471
This commit is contained in:
parent
d4e5d47133
commit
db3c853893
31
bjtu/1995/1995.cpp
Normal file
31
bjtu/1995/1995.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user