Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 总是 RE 求高人指点。

Posted by dxacm at 2010-06-10 03:28:14 on Problem 3096
```#include <iostream>
#include <cstring>

using namespace std;

typedef bool MvTable[26][26];

int main() {
while (true) {
string line;
getline(cin, line);
if (line == "*") break;
if (line.length() == 1) {
cout << line << " is surprising." << endl;
continue;
}
MvTable* hash = new MvTable[line.length()];
memset(hash, (char)0, line.length() * 26 * 26);
for (unsigned int y = 1; y < line.length(); y++) {
for (unsigned int x = 0; x < y; x++) {
if (hash[line[x]-'A'][line[y]-'A'][y - x - 1] == false) {
hash[line[x]-'A'][line[y]-'A'][y - x - 1] = true;
} else {
cout << line << " is NOT surprising." << endl;
goto finally;
}
}
}
cout << line << " is surprising." << endl;
finally:
delete [] hash;
}

return 0;
}```

Followed by: