Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import sys
- if __name__ == '__main__':
- #sys.stdin = open('in.txt', 'r')
- n = int(input())
- l = []
- for i in range(n):
- l.append(input())
- y = json.loads(l[0])
- nbcit = 0
- dicPub = {}
- dicPubValues = {}
- pub_one = json.loads(l[0])
- for i in pub_one['publications']:
- # print(i)
- dicPub[i['publicationNumber']] = i['publicationTitle']
- year_list = i['articleCounts']
- for j in year_list:
- # print(j)
- if int(j['year']) == 2017 or int(j['year']) == 2018:
- if i['publicationNumber'] not in dicPubValues.keys():
- dicPubValues[i['publicationNumber']] = 0
- dicPubValues[i['publicationNumber']] += int(j['articleCount'])
- dicCit = {}
- for i in range(1, n):
- y = json.loads(l[i])
- o = y["paperCitations"]
- for i in o['ieee']:
- # print(i)
- if int(i['year']) == 2017 or int(i['year']) == 2018:
- if i['publicationNumber'] not in dicCit.keys():
- dicCit[i['publicationNumber']] = 0
- dicCit[i['publicationNumber']] += 1
- # print(dicCit)
- # print(dicPub)
- # print(dicPubValues)
- finalList = []
- for key in dicPubValues.keys():
- x = (dicCit[key] / dicPubValues[key])
- s = (dicPub[key], round(x, 2))
- # s = ('{}: {:.2f}'.format(dicPub[key], round(x, 2)))
- touched = False
- if len(finalList) == 0:
- finalList.insert(0, s)
- else:
- for i, value in enumerate(finalList):
- if value[1] <= s[1]:
- finalList.insert(i, s)
- touched = True
- break
- if not touched:
- finalList.append(s)
- # finalList.append(s)
- for s in finalList:
- print("{}: {:.2f}".format(s[0] , s[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement