蓝桥杯刷题(十四)

1.小平方

代码

python 复制代码
n = int(input())
count=0
def f(x)->bool: # 判断条件
    return True if x**2%n<n/2 else False
for i in range(1,n): # 遍历[1,n-1],符合题意计数加一
    if f(i):
        count+=1
print(count)

2.3的倍数

代码

python 复制代码
a = int(input())
b = int(input())
c = int(input())
if (a+b)%3==0 or (a+c)%3==0 or (b+c)%3==0:
    print('yes')
else:
    print('no')

3.格点

代码

python 复制代码
count=0
for i in range(1,2022):
    for j in range(1,2022):
        if i*j<=2021:
            count+=1
print(count)
相关推荐
RSABLOCKCHAIN7 小时前
AI Agents in LangGraph-2
人工智能·python
WA内核拾荒者8 小时前
WhatsApp 账号异常检测的自动化告警系统设计
数据库·python·自动化
糖果店的幽灵8 小时前
人已经用 WorkBuddy 找工作拿了面试,你还在一份份手工改简历
人工智能·面试·职场和发展·langgraph
码流怪侠9 小时前
【GitHub】Bend:让 GPU 并行编程像写 Python 一样简单
python·github
2401_8949155310 小时前
GEO 搜索优化完整源码从零部署:环境配置、集群搭建全流程
开发语言·python·tcp/ip·算法·unity
zhiSiBuYu051711 小时前
Python3 模块开发与应用实战指南
python
databook12 小时前
用方差阈值过滤掉“惰性特征”
python·机器学习·scikit-learn
Freak嵌入式12 小时前
MCU 低功耗模式解析:时钟门控、电源门控、深度休眠
人工智能·python·单片机·嵌入式硬件·开源·依赖倒置原则·micropython
尤乐娃子13 小时前
进入大厂(厂子大)实习Day4
职场和发展·实习