Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddd #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

ddd #36

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 1 lingqi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>

def solveMeFirst(a,b):
# Hint: Type return a+b below
return a+b;

num1 = int(input())
num2 = int(input())
res = solveMeFirst(num1,num2)
print(res)
SyntaxError: invalid syntax
>>>
>>>
23 changes: 23 additions & 0 deletions 2 lq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import sys

#
# Complete the simpleArraySum function below.
#
def simpleArraySum(ar):
return sum(ar)

if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

ar_count = int(input())

ar = list(map(int, input().rstrip().split()))

result = simpleArraySum(ar)

fptr.write(str(result) + '\n')

fptr.close()


36 changes: 36 additions & 0 deletions 3 lq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import math
import os
import random
import re
import sys

# Complete the compareTriplets function below.
def compareTriplets(a, b):
result=[0,0]
for i in range(3):
if a[i]>b[i]:
result[0] += 1
if a[i]<b[i]:
result[1] += 1
return result



if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

a = list(map(int, input().rstrip().split()))

b = list(map(int, input().rstrip().split()))

result = compareTriplets(a, b)

fptr.write(' '.join(map(str, result)))
fptr.write('\n')

fptr.close()

SyntaxError: multiple statements found while compiling a single statement
>>>
24 changes: 24 additions & 0 deletions 4 lq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import math
import os
import random
import re
import sys

# Complete the aVeryBigSum function below.
def aVeryBigSum(ar):
result = sum(ar)
return result
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

ar_count = int(input())

ar = list(map(int, input().rstrip().split()))

result = aVeryBigSum(ar)

fptr.write(str(result) + '\n')

fptr.close()
34 changes: 34 additions & 0 deletions 5 lq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import math
import os
import random
import re
import sys

# Complete the diagonalDifference function below.
def diagonalDifference(arr):
sum1=0
sum2=0
a=b=0
while a<n:
sum1+=arr[a][a]
a+=1
while b<n:
sum2+=arr[b][n-b-1]
b+=1
return abs(sum1-sum2)

if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

n = int(input())

arr = []

for _ in range(n):
arr.append(list(map(int, input().rstrip().split())))

result = diagonalDifference(arr)

fptr.write(str(result) + '\n')

fptr.close()