Problem 2104 Floor problem

Accept: 376    Submit: 433
Time Limit: 1000 mSec    Memory Limit : 32768 KB

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;
}

FZU 2104 (13.11.28)的更多相关文章

  1. 第十周 11.28 psp0

    课堂测试总结 学生:马小心                                              日期:2017.11.28 作业号 日期 过程 估计数据 实际数据 累计数据 时间 ...

  2. ubuntu14.04 64位系统下编译3.13.11内核源码

    该过程一共分为四步: 1.下载内核:我下载的是3.13.11这个版本的内核! 2.解压内核:我将其解压/home/jello/Downloads/linux-3.13.11目录下!下文将会基于此目录编 ...

  3. 黑盒测试实践--Day4 11.28

    黑盒测试实践--Day4 11.28 今天完成任务情况: 分块明确自己部分的工作,并做前期准备 完成被测系统--学生管理系统的需求规格说明书 完成Mook上高级测试课程的第六章在线学习,观看自动化测试 ...

  4. 【2020.11.28提高组模拟】T1染色(color)

    [2020.11.28提高组模拟]T1染色(color) 题目 题目描述 给定 \(n\),你现在需要给整数 \(1\) 到 \(n\) 进行染色,使得对于所有的 \(1\leq i<j\leq ...

  5. JZOJ 11.28 提高B组反思

    JZOJ 11.28 提高B组反思 被打崩了呀 下次打提高A去了(逃 T1 刚开始没有读懂题,后来读懂了以后没有思路.没有想到是一个构造题,对同构的性质没有了解清楚,题解也讲的不明不白,懵-- T2 ...

  6. 【final】站立会议---11.28

    名称:nice! 组长:李权 成员:韩媛媛 刘芳芳 宫丽君 于淼 项目名称:约跑app 时间:11月28日 12:30 内容: 新任务的分配 1.李权分配任务 2.韩媛媛写站立会议 3.刘芳芳修改BU ...

  7. cmake-cmake.1-3.11.4机翻

    指数 下一个 | 上一个 | CMake » git的阶段 git的主 最新发布的 3.13 3.12 3.11.4 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 ...

  8. UVA 408 (13.07.28)

     Uniform Generator  Computer simulations often require random numbers. One way to generatepseudo-ran ...

  9. UVA 10392 (13.07.28)

    Problem F: Factoring Large Numbers One of the central ideas behind much cryptography is that factori ...

随机推荐

  1. Problem 1010 - 素数环问题

    #include<iostream> #include<string> #include<algorithm> #include<vector> #in ...

  2. 我的Hibernate入门

    今天忙了一整天,终于搭建好了我的第一个Hibernate程序,中间关于hibernate.cfg.xml的问题搞了半天,不过最后还是搞明白了,下面来讲一讲过程. 首先在你的eclipse中安装Hibe ...

  3. 运用预加载提升H5移动页面的用户体验

    原文地址:http://www.grycheng.com/?p=2188 在做h5移动页面,相信大家一定碰到过页面已经打开,但是里面的图片还未加载出来的情况,这种问题虽然不影响页面的功能,但是不利于用 ...

  4. Python 手册——参数传递以及交互模式

    我们先来看参数传递. 调用解释器时,脚本名和附加参数之传入一个名为sys.argv的字符串列表.没有脚本和参数时,它至少也有一个 元素:sys.argv[0]此时为空字符串.脚本名指定为‘ - ’(表 ...

  5. Python环境搭建中解决C编译的问题

    下载必要文件 Python Microsoft Visual C++ Compiler for Python 2.7 setuptools 安装Python 安装VCForPython27 在命令行下 ...

  6. smali 语法之try catch语句

    # virtual methods .method public onClick(Landroid/view/View;)V .locals 4 .parameter "v" .p ...

  7. Java 内存区域和GC机制--备用

    Java垃圾回收概况 Java GC(Garbage Collection,垃圾收集,垃圾回收)机制,是Java与C++/C的主要区别之一,作为Java开发者,一般不需要专门编写内存回收和垃圾清理代 ...

  8. Linux 安装java

    Linux安装Java之后,不用像Windows那样设置环境变量,直接就可在命令行当中输入java或者javac看到效果

  9. Python抓取双色球数据

    数据来源网站http://baidu.lecai.com/lottery/draw/list/50?d=2013-01-01 HTML解析器http://pythonhosted.org/pyquer ...

  10. (转)Eclipse 下找不到或无法加载主类的解决办法

    转自:http://my.oschina.net/leejun2005/blog/106789,写的太好了! 有时候 Eclipse 会发神经,好端端的 project 就这么编译不了了,连 Hell ...