Last active
April 7, 2018 10:48
-
-
Save maelfosso/139844d7b28e2ee07b4afbf03efa4598 to your computer and use it in GitHub Desktop.
Revisions
-
maelfosso revised this gist
Apr 7, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ import sys chef_sub_str = [ @@ -29,5 +28,4 @@ result = result + 1 # Print results print(result) -
maelfosso revised this gist
Apr 7, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Introduction The problem comes from [**codechef**](https://www.codechef.com/problems/FRK) It is an example of how we will work in **GDG Yaounde** # My Solution -
maelfosso revised this gist
Apr 7, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Introduction The problem comes from [**codechef**](https://www.codechef.com/problems/FRK) It is an example of how we will work in **GDG Yaounde** # My Solution -
maelfosso revised this gist
Apr 7, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Introduction The problem comes from (codechef)[https://www.codechef.com/problems/FRK] It is an example of how we will work in **GDG Yaounde** # My Solution 1. I create a vector containing substrings of length upper than 2 from the word `chef`. -
maelfosso revised this gist
Apr 7, 2018 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ # Introduction The problem comes from (**codechef**)[https://www.codechef.com/problems/FRK] # My Solution 1. I create a vector containing substrings of length upper than 2 from the word `chef`. 2. After reading all the username, I loop through them and and if an username contains one of the substring inside the vector create above then I will increment the result # Testing * Install `Python 3` * Run `python3 frk.py` -
maelfosso renamed this gist
Apr 7, 2018 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ``` import sys chef_sub_str = [ @@ -28,4 +29,5 @@ result = result + 1 # Print results print(result) ``` -
maelfosso created this gist
Apr 7, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ import sys chef_sub_str = [ 'ch', 'che', 'chef', 'he', 'hef', 'ef' ] # Read the number of potential friends N = int(input()) if not(1 <= N and N <= 5000): print("Error - ", N) # Read each friend and put it into the array users = [] for i in range(N): u = str(input()) if not(3 <= len(u) and len(u) <= 20) : sys.exit("Erreur ", u) users.append(u) # Find connections result = 0 for u in users: if any(s in u for s in chef_sub_str): result = result + 1 # Print results print(result)