1 条题解
-
1
注意到
数学知识点:
函数 f (x)=lnx 的导数 f'(x)=1/x。
题目输入一个正整数 x,计算 x 的倒数,结果保留 3 位小数输出。
C语言
#include <stdio.h> int main() { long long x; scanf("%lld", &x); double ans = 1.0 / x; printf("%.3lf", ans); return 0; }C++
#include <iostream> #include <iomanip> using namespace std; typedef long long ll; int main() { ll x; cin>>x; double ans=1.0/x; cout<<fixed << setprecision(3)<<ans; return 0; }Python
x = int(input()) res = 1.0/ x print("{0:.3f}".format(res))
信息
- ID
- 1159
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- 递交数
- 9
- 已通过
- 6
- 上传者