まともに解いてない…
0017
#include <iostream> #include <string> using namespace std; int main(){ string s, strCopy; while (getline(cin, s)) { for(int j=0 ; j<26 ; j++){ for(int i=0 ; i<s.size() ; i++){ if(s[i]>='a' && s[i]<='z'){ s[i] = (s[i]=='z')? 'a' : s[i] + 1; } } if( s.find( "the" ) != string::npos || s.find( "this" ) != string::npos || s.find( "that" ) != string::npos){ cout << s << endl; } } } return 0; }
SRM436 Div.2 Easy
class FriendScore { public: int highestScore( vector <string> friends ) { int res=0, cnt; for (size_t i=0; i<SZ(friends); i++) { cnt=0; for (size_t j=0; j<SZ(friends); j++) { if (i==j) { continue; } if (friends[i][j]=='Y') { cnt++; continue; } for (size_t k=0; k<SZ(friends); k++) { if (friends[i][k]=='Y'&&friends[k][j]=='Y') { cnt++; break; } } } res = max(res,cnt); } return res; } };