Created
October 29, 2016 16:38
-
-
Save takageymt/cb238f95cf17a9c3205ec80acf1006d4 to your computer and use it in GitHub Desktop.
誤読したまま書いたコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string isSquareFree(string s) { | |
for(int i = 1; i <= s.size()/2; i++) { | |
for(int j = 0; i + j <= s.size(); j++) { | |
string t = s.substr(j, i); | |
for(int k = j+i; i + k <= s.size(); k++) { | |
if(t == s.substr(k, i)) return "non square-free"; | |
} | |
} | |
} | |
return "square-free"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
commit