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
31 2 3100 2 100100 3 100
Sample Output
0382332
Source
“高教社杯”第三届福建省大学生程序设计竞赛
为高教杯复习而做,水题
直接贴AC代码:
#include<stdio.h>
int f(double x) {
int i;
for(i = 0; i <= 10000; i++)
if(x >= i && x < i+1)
break;
return i;
}
int main() {
int T;
scanf("%d", &T);
while(T--) {
int n, l, r;
int sum = 0;
scanf("%d %d %d", &n, &l, &r);
for(int i = l; i <= r; i++) {
double num = n / i;
sum += f(num);
}
printf("%d\n", sum);
}
return 0;
}
相关推荐
ACM数学_FZU...............绝密..........
This resource is related to the UI prototype design of the MIEC Software Engineering course project - FZU Flying Book.
不要下载此版的,请下载最新的http://download.csdn.net/source/1664620 离线版的福大acm在线评测OJ系统题目 更新到2009年8月 (注:chm电子书格式化)
求最大乘积 的源代码 次题是fzu 4月月赛题 是一道数学题啊
fzu online judge 的几道题,我的解题过程与思路,虽然都是很easy的题目,不过,重在参与嘛,哈哈
2021FZU计算机视觉作业(九)
2021FZU计算机视觉作业(七)
2021FZU计算机视觉期末复习
2021FZU计算机视觉作业(八)
fzu大数据基础实验4
C#miniword完整版,FZU作业,MINIWORD
dbc.sw.fzu同学录
FZU软件工程web课程复习资料-整理
FZU2021计算机视觉慕课答案(一)
这是关于我们飞跃手册项目的相关文档,包括成员分组信息表格,各组成员任务概要文档,项目日记等文档。 (This is a collection of documents relating to our Leapfrog Handbook project, including member ...
FZU软件工程操作系统课程复习资料-整理
2011 ACM 多校联合 2011 MU11 13 FZU
FZU2021计算机视觉答案(三)
FZU2021计算机视觉答案(四)
2021FZU计算机视觉答案(五)