逖靖寒的世界

每天进步一点点

导航

TopCoder Inv 2001 R1 200point

代码写得很乱~~~天呀~~

#include
<iostream>
#include
<string>
#include 
<cstring>
using namespace std;

class HowEasy
{
public:
    
int pointVal(string param0)
    {
        
int wordLength = 0;
        
int wordCount = 0;
        
for(int i = 0; i < param0.length(); i++){
            
bool isWord = false;
            
if (param0[i] != ' ') {
                
int c = 0;
                
if (i == 0 || param0[i - 1== ' '){
                    
while(i < param0.length() && ((param0[i] < 123 && param0[i] > 96|| (param0[i] < 91 && param0[i] > 64))){
                        c
++;
                        i
++;
                    }
                    
if (c > 0){
                        
if (i == param0.length() || param0[i] == ' ' || (param0[i] == '.' && (param0[i + 1== ' ' || i == (param0.length() - 1) ))) {
                            wordLength 
+= c;
                            wordCount
++;
                        }
                    }
                }
            }
        }

        
if (wordCount == 0return 250;
        
else{
            
int level = wordLength / wordCount;

            
if (level <= 3return 250;
            
else if (level <= 5return 500;
            
else return 1000;
        }
    }
};

posted on 2008-10-08 12:46  逖靖寒  阅读(555)  评论(4编辑  收藏  举报