Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <cassert>
  7. #include <cmath>
  8. #include <algorithm>
  9. #include <vector>
  10. #include <map>
  11. #include <set>
  12. #include <string>
  13. #include <queue>
  14. #include <stack>
  15. #include <deque>
  16. #include <time.h>
  17.  
  18. using namespace std;
  19.  
  20. #define forn(i,n) for (int i = int(0); i < int(n); i++)
  21. #define forb(i,n) for (int i = int(n-1); i >= int(0); i--)
  22. #define for1(i,n) for (int i = int(1); i <= int(n); i++)
  23. #define fore(i,a,n) for (int i = int(a); i < int(n); i++)
  24.  
  25. #define pb push_back
  26. #define mp make_pair
  27. #define fr first
  28. #define sc second
  29. #define sz size()
  30. #define sqr(x) ((x)*(x))
  31. #define cube(x) ((x)*(x)*(x))
  32. #define all(x) x.begin(), x.end()
  33. #define rall(x) x.rbegin(), x.rend()
  34. #define min3(a, b, c) min(a, min(b, c))
  35. #define max3(a, b, c) max(a, max(b, c))
  36. #define dist(x1, y1, x2, y2) sqrt(ld (sqr(x1 - x2) + sqr(y1 - y2)))
  37.  
  38. typedef long long ll;
  39. typedef long double ld;
  40. typedef unsigned long long ull;
  41.  
  42. const int maxn = 1000;
  43. const int MAXN = 30001;
  44. const int logn = 12;
  45. const int inf = (int) 1e9;
  46. const int alpha = 26;
  47. const int my_hash = 31;
  48. const long long base = (ll) 1e9;
  49. const long long my_mod = 2674894331;
  50. const long long l_inf = (ll) 4e18;
  51. const long long mod = (ll) 1e9 + 7;
  52. const long long l_mod = (ll) 1e18 - 11;
  53. const double fi = (sqrt(5.0) + 1) / 2.0;
  54. const double pi = acos(-1.0);
  55. const double eps = 1e-8;
  56. const double EPS = 0.00005;
  57.  
  58. char isSimple[6] = {'E', 'Y', 'U', 'I', 'O', 'A'};
  59.  
  60. bool simple(char symb) {
  61. for (int i = 0; i < 6; i++)
  62. if (isSimple[i] == symb)
  63. return true;
  64. return false;
  65. }
  66.  
  67. int main() {
  68. //srand(time(NULL));
  69. char symb;
  70. vector<long long> cnt(1, 0);
  71. while (scanf("%c ", &symb) != EOF) {
  72. bool check = simple(symb);
  73. cnt.pb(check ? 1ll : 0ll);
  74. }
  75. int n = int(cnt.sz) - 1;
  76. for (int i = 1; i <= n; i++)
  77. cnt[i] += cnt[i - 1];
  78. vector<long long> len(n + 1, 0);
  79. len[1] += cnt[n];
  80. for (int l = 2; l <= n; l++)
  81. len[l] = len[l - 1] - (cnt[n] - cnt[n - l + 1]) + (cnt[n] - cnt[l - 1]);
  82. double res = 0.0;
  83. for (int l = 1; l <= n; l++)
  84. res += double(len[l]) / double(l);
  85. printf("%.10lf", res);
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement