2014
02-17

# cube

4
1 1 1
2 2 2
2 2 3
3 2 2

16

YY, and YY
again
Time limit:
10sec.
Submitted:
278
Memory limit:
64M
Accepted:
182
Source: 2009
ACM/ICPC Asia Regional Harbin Site Onsite
Description
If we define each of the upper case letters a number, that is, 1
for A, 2 for B, 3 for C, … 25 for Y, 26 for Z, we can calculate a
mark for any word or sentence.
We believe that 100 points is the full mark, so for those word with
a mark larger than 100, we should just ignore that, with a label
“INVALID”. Then lets see interesting results:
What is the most important for your success?
HARD WORK? H+A+R+D+W+O+R+K=8+1+18+4+23+15+18+11=98
KNOWLEDGE? K+N+O+W+L+E+D+G+E=11+14+15+23+12+5+4+7+5=96
MONEY?(72)
LUCK?(47)
ATTITUDE! A+T+T+I+T+U+D+E=1+20+20+9+20+21+4+5=100
So just be with good attitude and you will be on your way to
success.
Input
For each case of the input, it contains a single line. For each
line, some characters will appear with maybe some of them being
upper case letters. All characters are printable. Each line will
have at most 127 characters.
Output
For each case, you should only pay attention to upper case letters
and calculate the total points. If it is over 100, “INVALID” should
be returned. Or you should print the exact point of that.
Sample Input
DELICIOUS FOOD
YY, and YY again!
did i lose anything?
Sample Output
INVALID
100
0

#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char** argv) {
const int size = 128;
char list[size];
int i, sum;
while (cin.getline(list, size)) {
sum = 0;
for (i = 0; i < strlen(list); i++) {
if (list[i] > 64 && list[i] < 97)
sum += static_cast<int> (list[i]) - 64;
}
if (sum > 100)cout << ”INVALID” << endl;
else cout << sum << endl;
}
return 0;
}

1. L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-1]）这个地方也也有笔误
应改为L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-2]）

2. 算法是程序的灵魂，算法分简单和复杂，如果不搞大数据类，程序员了解一下简单点的算法也是可以的，但是会算法的一定要会编程才行，程序员不一定要会算法，利于自己项目需要的可以简单了解。