FZU Problem 2104 Floor problem (数学啊 )
来源:互联网 发布:中国gdp季度数据 编辑:程序博客网 时间:2024/06/05 15:17
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2104
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
“高教社杯”第三届福建省大学生程序设计竞赛代码如下:
#include <cstdio>#include <cmath>int main(){ int t; int n, l, r; scanf("%d",&t); while(t--) { scanf("%d%d%d",&n,&l,&r); double sum = 0; for(int i = l; i <= r; i++) { sum+=floor(n*1.0/i); } printf("%.0lf\n",sum); } return 0;}
1 0
- FZU Problem 2104 Floor problem (数学啊 )
- FZU 2104 Floor problem(floor)
- FZU 2104 Floor problem
- FZU - 2104 Floor problem
- FZU Problem 2104 Floor problem
- fzu 2104 Floor problem(水题)
- FZU 2104 Floor problem(水题)
- D Floor problem(FZU 2104)
- FZU 2104 C - Floor problem
- FZU Problem 2110 Star (数学啊 )
- FZU Problem 2147 A-B Game (数学啊)
- FZU Problem 2151 OOXX Game (数学啊)
- FZU Problem 2102 Solve equation (数学啊 )
- FZU Problem 2111 Min Number (数学啊 )
- FZU Problem 2146 Easy Game ( 数学啊)
- Floor problem
- Floor problem
- Floor problem
- Android开发:申请微信AppID的MD5(数字签名)格式bug
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- 常用linux命令
- C#索引器
- Virtualbox虚拟机网络配置(NAT + Host-only - Bridged)
- FZU Problem 2104 Floor problem (数学啊 )
- Python 第二章 列表和元组(3) 列表
- 电脑无盘启动系统方案(by 星空武哥)
- 学习笔记No.4
- Java中Vector和ArrayList的区别
- (001)顺序栈的C++实现
- 数据结构实验:一元多项式的运算
- QT pro文件介绍
- 实验五1.1