Python Bài 7.B2. Music Stats Analyzer


LÀM BÀI

Points: 15 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Python

Mô tả bài toán

Phân tích thói quen nghe nhạc và tạo playlist thông minh.

INPUT FORMAT

  • Dòng 1: N - số lệnh
  • N dòng tiếp theo, mỗi lệnh có format:
    • P song,genre,time: phát nhạc
    • S song: skip bài
    • T type,k: xem top k
    • L mood: tạo playlist
    • A: xem thống kê

OUTPUT FORMAT

  • P: time listened
  • S: skipped
  • T: k items sorted by plays
  • L: k suggested songs
  • A: quick stats

VÍ DỤ

Input:
6
P shape,pop,180
P dance,edm,200
S sleep
T g,2
L happy
A
Output:
3.0m
3.3m
skipped
edm(3.3m)
pop(3.0m)
1.dance
2.shape
plays:2
time:6.3m
top:edm
skip:33%

Giải thích

  1. "3.0m" và "3.3m": Thời gian nghe mỗi bài hát được chuyển từ giây sang phút

    • shape: 180s = 3.0m
    • dance: 200s = 3.3m
  2. "skipped": Thông báo khi skip bài "sleep"

  3. "edm(3.3m), pop(3.0m)": Top 2 thể loại theo thời gian nghe

    • edm: 3.3m (dance)
    • pop: 3.0m (shape)
  4. "1.dance, 2.shape": Danh sách gợi ý cho tâm trạng "happy"

    • Sắp xếp theo thời gian nghe từ cao đến thấp
  5. Thống kê tổng quát (A):

    • plays:2 - Số bài hát đã phát (shape, dance)
    • time:6.3m - Tổng thời gian nghe (3.0m + 3.3m)
    • top:edm - Thể loại được nghe nhiều nhất
    • skip:33% - Tỷ lệ skip (1 skip / 3 lần tương tác)

Comments

There are no comments at the moment.

Zalo