news 2026/4/28 4:09:37

11:整数的个数

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
11:整数的个数
""" 【题目名称】整数的个数 【题目来源】http://noi.openjudge.cn/ch0105/11/ Author: 潘磊 <just_panlei@just.edu.cn> Version: 1.0 """# 自定义函数defoccurrence_of_specific_num(num_list,target:int)->int:""" 返回指定列表中指定数字出现的次数。 Args: num_list (list[int]): 指定列表 target (int): 指定数字 Returns: int: num_list中target出现的次数 """# 依次遍历num_list中的每个元素,如果它等于target,则累加1ans=sum(1fornuminnum_listifnum==target)returnansdefmain():n=int(input())num_list=list(map(int,input().split()))fortargetin[1,5,10]:print(occurrence_of_specific_num(num_list,target))if__name__=='__main__':main()
""" 【题目名称】整数的个数 【题目来源】http://noi.openjudge.cn/ch0105/11/ Author: 潘磊 <just_panlei@just.edu.cn> Version: 1.1 """# 自定义函数defoccurrence_of_specific_num(num_list,target:int)->int:""" 返回指定列表中指定数字出现的次数。 Args: num_list (list[int]): 指定列表 target (int): 指定数字 Returns: int: num_list中target出现的次数 """returnnum_list.count(target)# 调用count函数计算num_list中target出现的次数defmain():n=int(input())num_list=list(map(int,input().split()))fortargetin[1,5,10]:print(occurrence_of_specific_num(num_list,target))if__name__=='__main__':main()
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/28 4:05:27

Gemma 3n架构解析:模块化Transformer在多任务中的应用

1. Gemma 3n架构解析&#xff1a;当单一模型学会分身术去年在调试一个多任务推荐系统时&#xff0c;我不得不维护三个独立的模型分别处理内容理解、用户画像和排序预测。每次上线新特征都要重复三套测试流程&#xff0c;直到发现Google Research这篇MatFormer论文时&#xff0c…

作者头像 李华
网站建设 2026/4/28 4:03:29

Hermes vs OpenClaw:社区真实体验对比,谁更适合你?

Hermes vs OpenClaw&#xff1a;社区真实体验对比&#xff0c;谁更适合你&#xff1f;最近 Reddit 上一个关于 Hermes vs OpenClaw 的讨论帖引发了不少关注。作为两款热门的 AI Agent 框架&#xff0c;它们各有拥趸。本文整理了社区中真实用户的体验反馈&#xff0c;帮你了解两…

作者头像 李华
网站建设 2026/4/28 3:54:21

第十七届蓝桥杯省赛c++b组题解

蓝桥杯省赛自测&#xff08;CB 组&#xff09; - 洛谷 洛谷自测链接(由于数据原因 真实成绩可能与官方成绩有所出入) 1.青春常数 非常简单的入门题目 一共四年&#xff0c;前两年总和要小于后两年 即xy2026202520242023且x<y算出x的最大值即可(注意&#xff01;x可以为0 所…

作者头像 李华