-
Notifications
You must be signed in to change notification settings - Fork 1
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
Karsen Gauss
committed
Jan 9, 2017
1 parent
c9c1b87
commit 8aa957e
Showing
10 changed files
with
142 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Foundation | ||
|
||
|
||
if let line = readLine() { | ||
let numbers = line.components(separatedBy: " ") | ||
|
||
var sum: Int64 = 0 | ||
var min: Int64 = 1_000_000_000 | ||
var max: Int64 = 0 | ||
|
||
for i in numbers { | ||
let num = Int64(i)! | ||
sum += num | ||
if num <= min { | ||
min = num | ||
} | ||
if num >= max { | ||
max = num | ||
} | ||
} | ||
|
||
print("\(sum - max) \(sum - min)") | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
n = int(input().strip()) | ||
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')] | ||
print(sum(arr)) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
n,k,q = input().strip().split(' ') | ||
n,k,q = [int(n),int(k),int(q)] | ||
a = [int(a_temp) for a_temp in input().strip().split(' ')] | ||
for a0 in range(q): | ||
m = int(input().strip()) | ||
print(a[(m + n - k) % n]) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
a0,a1,a2 = input().strip().split(' ') | ||
a0,a1,a2 = [int(a0),int(a1),int(a2)] | ||
b0,b1,b2 = input().strip().split(' ') | ||
b0,b1,b2 = [int(b0),int(b1),int(b2)] | ||
|
||
a = [a0, a1, a2] | ||
b = [b0, b1, b2] | ||
|
||
aa, bb = 0, 0 | ||
for i, x in enumerate(a): | ||
if b[i] < x: | ||
aa += 1 | ||
elif b[i] > x: | ||
bb += 1 | ||
|
||
print('{0} {1}'.format(aa, bb)) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
n = int(input().strip()) | ||
a = [] | ||
for a_i in range(n): | ||
a_t = [int(a_temp) for a_temp in input().strip().split(' ')] | ||
a.append(a_t) | ||
|
||
acc = 0 | ||
i = 0 | ||
for row in a: | ||
acc += row[i] - row[n - 1 - i] | ||
i += 1 | ||
print(abs(acc)) |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
n = int(input().strip()) | ||
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')] | ||
|
||
pos = 0 | ||
neg = 0 | ||
|
||
for item in arr: | ||
if item > 0: | ||
pos +=1 | ||
elif item < 0: | ||
neg += 1 | ||
|
||
print("{0:.6f}".format(pos / n)) | ||
print("{0:.6f}".format(neg / n)) | ||
print("{0:.6f}".format((n - pos - neg) / n)) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
n = int(input().strip()) | ||
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')] | ||
acc = 0 | ||
for x in arr: | ||
acc += x | ||
print(acc) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
n = int(input().strip()) | ||
|
||
prin = "#" | ||
for i in range(n): | ||
print("{:>{align}}".format(prin, align=(n))) | ||
prin += "#" |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/python3 | ||
|
||
import sys | ||
|
||
|
||
time = input().strip().split(":") | ||
pm = time[2].endswith("PM") | ||
time[0] = int(time[0]) | ||
if pm: | ||
if time[0] < 12: | ||
time[0] += 12 | ||
time[2] = time[2].strip("PM") | ||
else: | ||
if time[0] == 12: | ||
time[0] = 0 | ||
time[2] = time[2].strip("AM") | ||
|
||
print("{:02d}:{}:{}".format(time[0], time[1], time[2])) |