Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
总是 RE 求高人指点。#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: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator