-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
435e08b
commit a8665e2
Showing
4 changed files
with
25 additions
and
27 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
inputString = input() | ||
# author: Higor Santos de Brito Dantas | ||
|
||
result = 1 | ||
string = raw_input() | ||
product = 1 | ||
|
||
for i in range(len(inputString)) : | ||
result = result * ord(inputString[i]) | ||
for e in string: | ||
product *= ord(e) | ||
|
||
print(result) | ||
print product |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
def binary_multiple(number): | ||
x = int(number,2) | ||
if x%3 == 0: | ||
return 1 | ||
else: | ||
return 0 | ||
|
||
test = int(input("Enter the number of test cases")) | ||
list1 = [] | ||
while test < 1 or test > 100: | ||
print("Number of test cases must be between 1 and 100") | ||
test = int(input("Enter the number of test cases")) | ||
for x in range(test): | ||
y = input("Enter the binary number") | ||
while len(y) < 1 or len(y) > 100: | ||
print("Length of input string must be between 1 and 100") | ||
y = input("Enter the binary number") | ||
list1.append(y) | ||
for x in range(test): | ||
print(binary_multiple(list1[x])) | ||
|
||
|
||
ntcases = int(input("Please type the number of test cases: ")) | ||
for i in range(ntcases): | ||
binaryString = input("Please type a binary number: ") | ||
exp = 0 | ||
result = 0 | ||
for bit in binaryString: | ||
result += int(bit)*(2**exp) | ||
exp = exp+1 | ||
if (result%3 == 0): | ||
print("1") | ||
else: | ||
print("0") | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fun main(args: Array<String>) { | ||
println("Hello, World!") | ||
} | ||
fun main(args : Array<String>) { | ||
println("Hello, world!") | ||
} |