POJ 3371 Flesch Reading Ease (simulation problem)

Source: Internet
Author: User
Tags bool printf

Flesch Reading ease:http://poj.org/problem?id=3371

The topic is very water, is to read the question on line.

Meaning

Give a normative article, ask its sentence number, word number and syllable number to put these 3 values into the title given formula, output its results, retain 2 decimal places.

Mark Word delimiters: commas (,) and spaces ()

Sentence separator: period (.) question mark (?) colon (:) semicolon (;) exclamation point (!)

Syllable Processing Requirements:

(1) When the total length of the word <=3, the number of syllables is unconditional +1

(2) When the total length of the word is >3, each occurrence of a vowel letter (a, E, I, O, u, y), syllable number +1, but the continuous (>=2) vowel letters are only 1 syllables, and when the word suffix is-es,-ed and-e, the vowel letter E of the suffix is not counted as syllables. But the suffix-le exception, to calculate the number of syllables.

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

Train of thought: Nothing to say, simulated water problem, do not know why no one do 0.0

#include <stdio.h> #include <string.h> bool Is_yuan (char c) {if (c = = ' A ' | | c = = ' E ' | | c = = ' I ' | | c = = ' O ' | | c = = ' U ' | |
    c = = ' Y ') return true;
    if (c = = ' A ' | | | c = = ' E ' | | | c = = ' I ' | | c = = ' O ' | | c = = ' U ' | | c = = ' Y ') return true;
return false;
    int main () {char s[1010];
    int sentences = 0, words = 0, syllables = 0;
        while (~SCANF ("%s", s)) {bool Qian = false;
        int len = strlen (s);
            if (Len <= 3) {syllables++;
        printf ("1");
                } else {if (Is_yuan (S[0])) {syllables++;
                Qian = true;
            printf ("%d", 0);
                for (int i = 1; i < Len; i++) {if (Is_yuan (s[i)) &&!qian)
                    {syllables++;
                   Qian = true;
                printf ("%d", I);
           }     else if (!is_yuan (S[i])) {Qian = false;  } if (s[len-1] = = ', ' | | s[len-1] = = '. ' | | s[len-1] = = ' | | | s[len-1] = = ' ~ ' | | s[len-1] = = '? ' || S[len-1] = = ': ' {if (s[len-2] = = ' E ' && s[len-3]!= ' l ' &&!is_yuan (s[len-3) )) || (S[len-2] = = = ' s ' && s[len-3] = = ' E ' &&!is_yuan (s[len-4)) | |
                (S[len-2] = = ' d ' && s[len-3] = = ' E ' &&!is_yuan (s[len-4)))
                    {syllables--;
                printf ("*"); } else {if (s[len-1] = = ' E ' && s[len-2]!= ' l ' &&! Is_yuan (s[len-2]) | | (S[len-1] = = = ' s ' && s[len-2] = = ' E ' &&!is_yuan (s[len-3)) | |
                (s[len-1] = = ' d ' && s[len-2] = = ' E ' &&!is_yuan (s[len-3)))
                    {syllables--;
         printf ("#");       }} if (s[len-1] = = '. ' | | s[len-1] = = ' | | | | s[len-1] = '! ' | | s[len-1] = = '? ' | | s[
        Len-1] = = = ': ') {sentences++;
        } words++;
    Puts ("");
    }//printf ("%d%d%d\n", syllables, words, sentences);
  
    printf ("%.2f\n", 206.835-1.015*words/sentences-84.6*syllables/words);
return 0; }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.