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. windows进程函数试炼

    实践一下windows进程相关函数: 代码如下: // test__getinformation.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h&quo ...

  2. 【清橙A1084】【FFT】快速傅里叶变换

    问题描述 离散傅立叶变换在信号处理中扮演者重要的角色.利用傅立叶变换,可以实现信号在时域和频域之间的转换. 对于一个给定的长度为n=2m (m为整数) 的复数序列X0, X1, …, Xn-1,离散傅 ...

  3. YZOI Easy Round 2_回文串 string

    原文链接:http://laphets1.gotoip3.com/?id=18 Description 给出一个由小写字母组成的字符串,其中一些字母被染黑了,用?表示.已知原来的串不是 一个回文串,现 ...

  4. php和js根据子网掩码和ip计算子网

    php $ip = '192.168.6.1'; $mask = '255.255.2.0'; $sub_net = array();//子网 $ip_explode = explode('.', $ ...

  5. 【小结】有关mysql扩展库和mysqli扩展库的crud操作封装

    现阶段php如果要操作mysql数据库 php给我们提供了3套库 1.mysql扩展库   面向过程操作 2.mysqli扩展库  面向对象操作和面向过程操作并存  安全性和效率高于mysql扩展库 ...

  6. jquery前端性能优化(持续添加。。。)

    1.选择器的使用 (1)$('#id')   使用id来定位dom元素是性能最高的方法.jQuery底层将直接调用本地方法document.getElementById().如果id直接可以找到所要对 ...

  7. python消息队列snakemq使用总结

    Python 消息队列snakemq总结 最近学习消息总线zeromq,在网上搜了python实现的消息总线模块,意外发现有个消息队列snakemq,于是拿来研究一下,感觉还是很不错的,入手简单使用也 ...

  8. iOS:不同属性声明方式的解析

    代码: /* 属性声明方式说明: ----------------------- 1 @interface ... { id name } @end 这样声明的属性其实可以认为是private属性,因 ...

  9. DBA - 我的学习

    DBA - 我的学习 1. df -k 检查oracle 分区硬盘使用情况 2. 检查alert_<SID名称>.log, alert日志文件,检查是否新增错误日志 3. 检查数据文件的状 ...

  10. 教你把UIView切成任意形状

    有时候layer.cornerRadius并不能满足需求,自己实现drawRect又太麻烦,怎么办? 多的不说,直接上代码: - (void)dwMakeBottomRoundCornerWithRa ...