<p><span style="font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">제가 지인들과 롤 대회를 열었는데요, </span></p> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"><br></div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">총 25명이 참가하는데, 팀간의 밸런스를 위해서 개인별로 실력에따라 점수를 배점하고 각팀의 점수 합계가 같게해서 대회를 진행하려고 합니다.</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"><br></div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">이렇게 팀을 구성할경우, 어떤팀이 가능한지 경우의 수를 좀 프로그래밍으로 돌려서 보고싶은데요,</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"><br></div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">먼저</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"><br></div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"> <div style="margin:0px;padding:0px;">from itertools import product</div> <div style="margin:0px;padding:0px;">import os</div> <div style="margin:0px;padding:0px;"><br></div> <div style="margin:0px;padding:0px;">players = [</div> <div style="margin:0px;padding:0px;"> ('칼라디아', 5), ('채팅', 4), ('꾸이한끼', 4), ('썸바드헬미', 2.5), ('이중룡볼리베어', 2.5),</div> <div style="margin:0px;padding:0px;"> ('평원로', 6), ('괄약근조이기', 5.5), ('아기천사', 4), ('주량5잔', 4), ('낭만주의', 3.5),</div> <div style="margin:0px;padding:0px;"> ('권매끈', 5.5), ('띤딴보', 4), ('루제짱', 4), ('투투나', 4), ('크로라인', 4),</div> <div style="margin:0px;padding:0px;"> ('리승준', 7), ('패럿빌', 7), ('크헤', 4.5), ('초보다난', 3.5), ('우빈장', 3.5),</div> <div style="margin:0px;padding:0px;"> ('케리뭉', 2.5), ('롤악귀', 1.5), ('선하나', 1.5), ('추니클라스', 1.5), ('반만쥬', 0)</div> <div style="margin:0px;padding:0px;">]</div> <div style="margin:0px;padding:0px;">team_combinations = list(product(players[:5], players[5:10], players[10:15], players[15:20], players[20:]))</div> <div style="margin:0px;padding:0px;"><br></div> <div style="margin:0px;padding:0px;">team_strs = [', '.join(f"{player[0]}({player[1]}점)" for player in team) </div> <div style="margin:0px;padding:0px;"> for team in team_combinations if sum(player[1] for player in team) == 19]</div> <div style="margin:0px;padding:0px;"><br></div> <div style="margin:0px;padding:0px;">desktop_path = os.path.join(os.path.expanduser("~"), "desktop")</div> <div style="margin:0px;padding:0px;">file_path = os.path.join(desktop_path, '경우의 수들.txt')</div> <div style="margin:0px;padding:0px;"><br></div> <div style="margin:0px;padding:0px;">with open(file_path, 'w') as file:</div> <div style="margin:0px;padding:0px;"> for i, team_str in enumerate(team_strs, start=1):</div> <div style="margin:0px;padding:0px;"> file.write(f"팀 {i}: {team_str}\n")</div> </div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"><br></div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">이 코드를 파이썬에 입력했더니,</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"> </div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"> <p><img src="http://thimg.todayhumor.co.kr/upfile/202401/17046748324b91f72d8642472cb1bbebca002f504b__mn807392__w607__h552__f129123__Ym202401.jpg" alt="경우의수들.jpg" style="width:607px;height:552px;" filesize="129123"></p> <p> </p> <p>이런식으로 나오드라구여. 예전에 프로그래밍하던 친구가 대회 했을때는</p> <p> </p> <p><img src="http://thimg.todayhumor.co.kr/upfile/202401/1704674863bf896e3deca041cf96c2b5f9aaf7993c__mn807392__w618__h287__f56043__Ym202401.jpg" alt="원하는것.jpg" style="width:618px;height:287px;" filesize="56043"></p> </div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">이렇게 모든 팀이 다 짜여진 경우의 수를 보여줬었거든여?</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"> </div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">이런식으로 경우의수를 다 보여줄수있게 코드를 수정해주실수있는분 있나여?</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"> </div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;">챗gtp에 물어봐도 자꾸 저런식으로 안알려주고 팀을 라인상관없이 섞어버린다던지 조합을 한개만 알려준다던지 에러가 있는 코드를 알려준다던지 막 그러던데 능력자분들계시면 도움좀 꼭 부탁드립니다 ㅠㅠ</div> <div style="margin:0px;padding:0px;font-family:'-apple-system', BlinkMacSystemFont, Helvetica, 'Apple SD Gothic Neo', '맑은 고딕', 'Malgun Gothic', Dotum, '돋움', sans-serif;font-size:16px;background-color:#ffffff;"> </div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.