数字比较游戏:小磊小萌谁的数字符号种类多?
```python def count_digit_types(num): digit_set = set() while num > 0: digit = num % 10 digit_set.add(digit) num //= 10 return len(digit_set) n, m = map(int, input().split()) n_digit_types = count_digit_types(n) m_digit_types = count_digit_types(m) if n_digit_types > m_digit_types: print("congratulations, xiaolei.") elif n_digit_types < m_digit_types: print("congratulations, xiaomeng.") else: print("we both win.") ``` ######[AI写代码神器 | 158点数解答 | 2024-10-18 11:41:44]
相关提问
- 超燃年会来袭!诗舞歌戏轮番上阵,共赴欢乐盛宴! (字节豆包 | 206点数解答 | 2025-01-08 10:59:43)361
- C++ 实现:精准统计给定范围 [L, R] 内数字 2 出现的次数及代码详解(字节豆包 | 401点数解答 | 2026-02-05 21:17:05)62
- C++实现:统计[L, R]范围内数字2出现的次数及代码详解(字节豆包 | 489点数解答 | 2026-02-07 17:12:26)77
- Python:用正则表达式从含多种字符的字符串中提取英文、数字和中文单词(GPT | 522点数解答 | 2024-05-31 19:05:27)335
- Python:用正则表达式结合 split 思路提取一行字符串中的英文、数字和中文单词 (GPT | 399点数解答 | 2024-05-31 19:07:31)331
- 繁体字编码代码修改:人物名字合法性验证函数转简体版(字节豆包 | 325点数解答 | 2024-10-21 18:57:01)305
- 计算区间 n 到 m 中数字 x 出现次数的 Python 实现与详解(字节豆包 | 289点数解答 | 2025-12-07 17:14:59)94
- Python 实现:计算区间 n 到 m 中数字 x 出现的次数(字节豆包 | 322点数解答 | 2025-12-13 21:37:08)97
- Java 利用 DFA 判断输入字符串是否为 4 位无符号整数(字节豆包 | 423点数解答 | 2024-10-07 19:23:58)411
- Python实现输出九九乘方表前n行,代码详解!(字节豆包 | 151点数解答 | 2025-11-10 20:16:35)135
- C++实现:输出九九乘方表前n行及代码详细解析(字节豆包 | 418点数解答 | 2025-11-10 20:16:57)128
- Python 实现浮点数转百分比并保留 2 位小数(字节豆包 | 181点数解答 | 2026-03-14 18:09:36)24