FZOJ2104:Floor problem
来源:互联网 发布:软件工程学不学高数 编辑:程序博客网 时间:2024/05/16 15:52
Problem Description
In this problem, we have f(n,x)=Floor[n/x]. Here Floor[x] is the biggest integer such that no larger than x. For example, Floor[1.1]=Floor[1.9]=1, Floor[2.0]=2.
You are given 3 positive integers n, L and R. Print the result of f(n,L)+f(n,L+1)+...+f(n,R), please.
Input
The first line of the input contains an integer T (T≤100), indicating the number of test cases.
Then T cases, for any case, only 3 integers n, L and R (1≤n, L, R≤10,000, L≤R).
Output
For each test case, print the result of f(n,L)+f(n,L+1)+...+f(n,R) in a single line.
Sample Input
3
1 2 3
100 2 100
100 3 100
Sample Output
0
382
332
题意:给出,n,l,r,求所有n/i(l<=i<=r)的和
思路:水题
#include <stdio.h>#include <string.h>int main(){int t,n,l,r,sum,i;scanf("%d",&t);while(t--){scanf("%d%d%d",&n,&l,&r);sum = 0;for(i = l;i<=r;i++)sum+=n/i;printf("%d\n",sum);}return 0;}
- FZOJ2104:Floor problem
- Floor problem
- Floor problem
- Floor problem
- FZU 2104 Floor problem
- FZU - 2104 Floor problem
- FZU Problem 2104 Floor problem
- FZU 2104 Floor problem(floor)
- FZU 2104 C - Floor problem
- fzu 2104 Floor problem(水题)
- FZU 2104 Floor problem(水题)
- D Floor problem(FZU 2104)
- FZU Problem 2104 Floor problem (数学啊 )
- floor
- floor () 函数
- Math.floor
- Math.floor
- floor函数
- android4.0新控件Switch方法解析
- static_cast、dynamic_cast reinterpret_cast和const_cast
- jquery ajax get
- linux应用编程:socket 常用API总结
- 解读ClassLoader
- FZOJ2104:Floor problem
- JS调用页面
- Unix原理与应用(第四版)学习笔记3--系统调用之进程篇
- Linux 锁相关
- String中null变为"null"字符串的问题
- FCLK/HCLK/PCLK的配置(2)
- 谁会是中国的Zillow?
- Windbg调试内核驱动方法1
- ubuntu更新android代码网络连接问题