# Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song

E. Pretty Song
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

When Sasha was studying in the seventh grade, he started listening to music a lot. In order to evaluate which songs he likes more, he introduced the notion of the song's prettiness. The title of the song is a word consisting of uppercase Latin letters. The prettiness of the song is the prettiness of its title.

Let's define the simple prettiness of a word as the ratio of the number of vowels in the word to the number of all letters in the word.

Let's define the prettiness of a word as the sum of simple prettiness of all the substrings of the word.

More formally, let's define the function vowel(c) which is equal to 1, if c is a vowel, and to 0 otherwise. Let si be the i-th character of string s, and si..j be the substring of word s, staring at the i-th character and ending at the j-th character (sisi + 1... sji ≤ j).

Then the simple prettiness of s is defined by the formula:

The prettiness of s equals

Find the prettiness of the given song title.

We assume that the vowels are I, E, A, O, U, Y.

Input

The input contains a single string s (1 ≤ |s| ≤ 5·105) — the title of the song.

Output

Print the prettiness of the song with the absolute or relative error of at most 10 - 6.

Sample test(s)
input
IEAIAIO

output
28.0000000

input
BYOB

output
5.8333333

input
YISVOWEL

output
17.0500000

Note

In the first sample all letters are vowels. The simple prettiness of each substring is 1. The word of length 7 has 28 substrings. So, theprettiness of the song equals to 28.

1/1  1/2    1/3   1/4     1/5

1      1       1      1      1

1      2      2      2 1

1 2 3 2 1

1 2 2 2 1

1 1 1 1 1

#define INF			9000000000
#define EPS			(double)1e-9
#define mod			1000000007
#define PI			3.14159265358979
//*******************************************************************************/
#endif
#define N 500050
#define M 100005
#define maxn 205
#define MOD 1000000000000000007
int n,dp[N];
char str[6] = { 'I','E','A','O','U','Y'},pri[N];
bool isalpho(char c){
FI(6)
if(str[i] == c)
return true;
return false;
}
int main()
{
double sum = 0,s = 0,s2 = 0;
while(SS(pri)!=EOF)
{
memset(dp,0,sizeof(dp));
sum = 0; s = 0;s2 = 0;
n = strlen(pri);
FI(n){
s+=1.0/(i+1);
}
s2 = s;
int k = (n&1)?n/2+1:n/2;
FI(n){
if(isalpho(pri[i])){
sum += s2;
}
s-= 1.0/(i + 1) + 1.0/(n- i);
s2 += s;
}
printf("%.6f\n",sum);
}
return 0;
}

• 本文已收录于以下专栏：

## Codeforces Round #289 (Div. 2, ACM ICPC Rules)E. Pretty Song

E. Pretty Song time limit per test 1 second memory limit per test 256 megabytes input st...

## Codeforces Round #289 (Div. 2, ACM ICPC Rules) -- B. Painting Pebbles （贪心）

B. Painting Pebbles time limit per test 1 second memory limit per test 256 megabytes ...

## Codeforces Round #289 (Div. 2, ACM ICPC Rules)

• wcr1996
• 2015年02月01日 00:19
• 1179

## Codeforces Round #289 (Div. 2, ACM ICPC Rules) B. Painting Pebbles

B. Painting Pebbles time limit per test 1 second memory limit per test 256 megabytes inpu...

## Codeforces Round #289 (Div. 2, ACM ICPC Rules)C. Sums of Digits

C. Sums of Digits time limit per test 2 seconds memory limit per test 256 megabytes input...

## Codeforces Round #116 (Div. 2, ACM-ICPC Rules) E - Cubes

#include #include #include #include #include #include #include #include #include #include #include #...
• zz_1215
• 2012年04月22日 17:52
• 448

## Codeforces Round #116 (Div. 2, ACM-ICPC Rules)---E. Cubes

Let’s imagine that you’re playing the following simple computer game. The screen displays n lined-up...

## Codeforces Round #145 (Div. 2, ACM-ICPC Rules)

• loinus
• 2012年10月17日 10:39
• 381

举报原因： 您举报文章：Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)