题解列表

筛选

[编程入门]自定义函数处理素数

摘要:注意事项:本题很容易超时,用cmath库里的sqrt函数来求循环终止数可以避免超时以下为c++代码参考代码:#include<iostream>#include<cmath>using namespa……

1739: 成绩排序

摘要:解题思路:注意事项:参考代码:#include<stdio.h> #include<string.h> struct stu{     char name[101];     int age;……

字符格式化

摘要:解题思路:。。。。。。。。注意事项:。。。。。。。。。参考代码:n=int(input()) print(format(int(oct(n),8),&#39;o&#39;))……

温度转换,两行

摘要:解题思路:。。。。。。。。。。。。。。。。。注意事项:。。。。。。。。。。。。。。。参考代码:f=int(input()) print(&#39;{:.2f}&#39;.format(5/9*(f-……

凑个数。。。。。

摘要:解题思路:。。。。。。。。。。。。。。。注意事项:。。。。。。。。。。。。。。。参考代码:x = float(input()) if x < 1:    y = x elif x >= 1 an……

公式法求解

解题思路:等差公式前n项和:Sn=na1+n(n-1)d/2=(a1+an)n/2.注意事项:参考代码:n=int(input())a1,an=2,2+3*(n-1)print(int((a1+an)*n/2))