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. Bresenham画直线,任意斜率

    function DrawLineBresenham(x1,y1,x2,y2) %sort by x,sure x1<x2. if x1>x2 tmp=x1; x1=x2; x2=tmp; ...

  2. windows注册表的基本使用——示例

    上网找好多资料发现一个问题就是太老.例如只有RegCreateKey而没有RegCreateKeyEx用法详解,自己摸索了几个小时终于基本用到的几个函数都试用了一遍. 下面代码已经通过编译测试 // ...

  3. [学习笔记]设计模式之Flyweight

    为方便读者,本文已添加至索引: 设计模式 学习笔记索引 写在前面 Flyweight(享元)模式运用共享技术,可以有效地支持大量细粒度的对象.今天我们会去参观小霍比特人们的酿酒工坊……等等,不是享元模 ...

  4. Java之加密(信息摘要)工具类(依赖:java.security.MessageDigest或org.apache.commons.codec.digest.DigestUtils)

    依赖于java.security.MessageDigest,支持MD5,SHA-1,SHA-256 import java.security.MessageDigest; import java.s ...

  5. javaScript常用方法整合(项目中用到过的)

    防止输入空格.缩进等字符: function trim(str){ return str.replace(/^\s+|\s+$/g,""); } JS去掉style样式标签 fun ...

  6. Linux(Fedora)下NodeJs升级最新版本(制定版本)

    Linux(Fedora)下NodeJs升级最新版本(制定版本) 首先安装n模块: npm install -g n 升级node.js到最新稳定版 n stable 升级node.js到制定版本 n ...

  7. DAC,MAC和SELinux,SEAndroid

    1. 被ROOT了怎么办 2. SELinux 3. SEAndroid 4. JB(4.3) MR2的漏洞弥补 ------------------------------------------- ...

  8. Python正则表达式2

  9. shell 常用

    /etc/password      用户的 home路径设置 chwon  groupname:username    path_or_file  -R    # 修改文件左右者 chomd

  10. 学习Swift -- 继承

    继承 一个类可以继承另一个类的方法(methods),属性(properties)和其它特性.当一个类继承其它类时,继承类叫子类,被继承类叫超类(父类). 在 Swift 中,子类可以调用和访问父类的 ...