Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
more
Archives
Today
Total
관리 메뉴

PythonHolic

[python] 민수의 마법 항아리 문제 본문

파이썬 과제 도와주기 일지

[python] 민수의 마법 항아리 문제

devpy 2020. 6. 25. 15:41

여기서 체크 표시는 "α" 입니다

 

 

 

aim = int(input("목표로 하는 금액 >>> "))
total = 0
day = 0
while True:

    count=0
    alpha = 0
    
    if total < aim:
        if day==0:
            m = int(input("넣을 돈 >>> "))

            for i in range(1,m+1):
                if m % i==0:
                    count+=1

            if count>=50:
                alpha = m
            elif count<50 and count>=30:
                alpha = 10000
            elif count<30:
                alpha = 100

            total = 2*m+alpha
            
            
        elif day>0:
            for i in range(1,total+1):
                if total % i==0:
                    count+=1
                    
            if count>=50:
                alpha = total
            elif count<50 and count>=30:
                alpha = 10000
            elif count<30:
                alpha = 100
                
            total = 2*total+alpha
            
        day+=1

    if total > aim:
        print("최종금액 {}원".format(total))
        print("걸리는 시간 {}일".format(day))
        break
Comments