Back to 用 Python 做商管程式設計（一）(Programming for Business Computing in Python (1))

# Learner Reviews & Feedback for 用 Python 做商管程式設計（一）(Programming for Business Computing in Python (1)) by National Taiwan University

4.9
213 ratings
64 reviews

Mar 03, 2019

Jun 23, 2018

Filter by:

## 1 - 25 of 63 Reviews for 用 Python 做商管程式設計（一）(Programming for Business Computing in Python (1))

By Peter C

Jul 08, 2018

The course is useful. I enjoyed solving the practice quizzes, though it took a long time trying and debugging.

By Yockey C

Mar 03, 2019

By 心愉 方

Dec 04, 2018

By Mu-hua L (

Jan 27, 2019

By 林晉宇

Feb 04, 2019

By Yi-He L

Nov 23, 2018

By 楊捷

Nov 09, 2018

By Liu T Y

Nov 11, 2018

By 琦 王

Jan 20, 2019

By Hong Y

Feb 16, 2019

:D

By

Feb 26, 2019

By 謝宛樺

Feb 25, 2019

By Atwo L

Mar 05, 2019

By jtc

Mar 03, 2019

By

Dec 02, 2018

By 于子越

Nov 15, 2018

Best instructor I have ever met

By Joyce C

Aug 05, 2018

By 王光維

Aug 05, 2018

import math

n = int(input())

p = int(input())

d = int(input())

#print(n, p, d)

TownInfor = []

for i in range(n):

TownInfor.append(input().split())

for j in range(3):

TownInfor[i][j] = int(TownInfor[i][j])

#print(TownInfor)

TownDst = []

for i in range(n):

TownDst.append([])

for j in range(n):

DstSquare = (TownInfor[i][0] - TownInfor[j][0]) ** 2 + (TownInfor[i][1] - TownInfor[j][1]) ** 2

TownDst[i].append(float("%.2f" % math.sqrt(DstSquare)))

#for EveryRowInTownDst in TownDst:

#print(EveryRowInTownDst)

NumBase = 0

TotalPopInThisArea = 0

TownPriority = []

TotalCoverPop = 0

for i in range(n):

TotalPopInThisArea += TownInfor[i][2]

while NumBase < p or TotalPopInThisArea < TotalCoverPop:

BestTown = 0

MaxSumOfPop = 0

for i in range(n):

SumOfPop = 0

for j in range(n):

if float(TownDst[i][j]) <= float(d):

SumOfPop += TownInfor[j][2]

if MaxSumOfPop < SumOfPop:

BestTown = i

MaxSumOfPop = SumOfPop

#print(BestTown, MaxSumOfPop)

TownPriority.append(BestTown + 1)

TotalCoverPop += MaxSumOfPop

for i in range(BestTown, BestTown + 1):

for j in range(n):

if float(TownDst[i][j]) <= float(d):

TownInfor[j][2] = 0

#print(TownInfor)

NumBase += 1

print(TownPriority, TotalCoverPop)

By Yun H H

Sep 01, 2018

By Hao-Chieh K

Sep 10, 2018

By 陳昱斌

Oct 10, 2018

By 家銘 張

Oct 12, 2018

By 李季澄

Oct 16, 2018

By 許毓翔

Sep 18, 2018

By 政霖 賴

Sep 23, 2018