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 == 0) return 250;
else{
int level = wordLength / wordCount;
if (level <= 3) return 250;
else if (level <= 5) return 500;
else return 1000;
}
}
};
#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 == 0) return 250;
else{
int level = wordLength / wordCount;
if (level <= 3) return 250;
else if (level <= 5) return 500;
else return 1000;
}
}
};