Created
January 26, 2024 00:58
-
-
Save Poxios/9a967fcb443af31aa7e56f04cdd6213d to your computer and use it in GitHub Desktop.
jungsan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const participants = ["은소", "종민", "의정", "연우", "서윤", "준하", "영현"] | |
type participants = typeof participants[number] | |
const events: { label: string, cost: number, target: participants[] }[] = [ | |
{ label: "하나로1", cost: 58_280, target: ["은소", "종민", "의정", "연우", "서윤", "준하", "영현"] }, | |
{ label: "하나로2", cost: 93_250, target: ["은소", "종민", "의정", "연우", "서윤", "준하", "영현"] }, | |
{ label: "주유비", cost: 61_800, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "싼타클로스 햄버거", cost: 96_500, target: ["은소", "종민", "의정", "연우", "서윤", "준하", "영현"] }, | |
{ label: "바베큐", cost: 30_000, target: ["은소", "종민", "의정", "연우", "서윤", "준하", "영현"] }, | |
{ label: "씨유 (얼음, 음료수)", cost: 7_800, target: ["은소", "종민", "의정", "연우", "서윤", "준하", "영현"] }, | |
{ label: "톨게이트", cost: 7_200, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파1", cost: 30_000, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파2", cost: 35_000, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파3", cost: 17_500, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파정산1", cost: 32_300, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파정산2", cost: 16_000, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파정산3", cost: 11_000, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "스파정산4", cost: 15_000, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
{ label: "초밥", cost: 38_000, target: ["연우", "서윤", "영현"] }, | |
{ label: "아이스크림", cost: 27_500, target: ["종민", "연우", "서윤", "준하", "영현"] }, | |
] | |
participants.forEach(p => { | |
console.log(`${p} : ${events.reduce((sum, e) => e.target.includes(p) ? (sum + (e.cost) / e.target.length) : sum, 0).toFixed(0)}`); | |
}) |
Author
Poxios
commented
Jan 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment