FZU 2104 (13.11.28)
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
Sample Input
Sample Output
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)的更多相关文章
- 第十周 11.28 psp0
课堂测试总结 学生:马小心 日期:2017.11.28 作业号 日期 过程 估计数据 实际数据 累计数据 时间 ...
- ubuntu14.04 64位系统下编译3.13.11内核源码
该过程一共分为四步: 1.下载内核:我下载的是3.13.11这个版本的内核! 2.解压内核:我将其解压/home/jello/Downloads/linux-3.13.11目录下!下文将会基于此目录编 ...
- 黑盒测试实践--Day4 11.28
黑盒测试实践--Day4 11.28 今天完成任务情况: 分块明确自己部分的工作,并做前期准备 完成被测系统--学生管理系统的需求规格说明书 完成Mook上高级测试课程的第六章在线学习,观看自动化测试 ...
- 【2020.11.28提高组模拟】T1染色(color)
[2020.11.28提高组模拟]T1染色(color) 题目 题目描述 给定 \(n\),你现在需要给整数 \(1\) 到 \(n\) 进行染色,使得对于所有的 \(1\leq i<j\leq ...
- JZOJ 11.28 提高B组反思
JZOJ 11.28 提高B组反思 被打崩了呀 下次打提高A去了(逃 T1 刚开始没有读懂题,后来读懂了以后没有思路.没有想到是一个构造题,对同构的性质没有了解清楚,题解也讲的不明不白,懵-- T2 ...
- 【final】站立会议---11.28
名称:nice! 组长:李权 成员:韩媛媛 刘芳芳 宫丽君 于淼 项目名称:约跑app 时间:11月28日 12:30 内容: 新任务的分配 1.李权分配任务 2.韩媛媛写站立会议 3.刘芳芳修改BU ...
- 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 ...
- UVA 408 (13.07.28)
Uniform Generator Computer simulations often require random numbers. One way to generatepseudo-ran ...
- UVA 10392 (13.07.28)
Problem F: Factoring Large Numbers One of the central ideas behind much cryptography is that factori ...
随机推荐
- [LeetCode OJ] Word Search 深度优先搜索DFS
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from l ...
- postman本地或远程访问不了
问题postman: 问题描述: 1.手动测试过不去http://121.199.54.31:8081/suppliers/Split 2.localhost:8080/microshop-settl ...
- cookie : 存储数据
cookie : 存储数据,当用户访问了某个网站(网页)的时候,我们就可以通过cookie来像访问者电脑上存储数据 1.不同的浏览器存放的cookie位置不一样,也是不能通用的 2.cookie的存储 ...
- Jquery 和 Js
jQuery [一] jQuery 1: javaScript和 javaScript库: (1) javaScript自身存在的3个弊端:复杂的文档对象模型(DOM),不 ...
- ajax请求遇到服务器重启或中断
常会有不断轮询发送ajax请求,处理一些业务的场景. 要考虑到: 1. 服务器重启,中断,恢复后仍然能恢复正常业务处理. 服务器重启过程中,再次发送请求,请求状态将变为net::ERR_CONNECT ...
- ExtJS中动态设置TextField的readOnly属性
第一种方式: textField, 如果知道textField的id = 'textField' 话,就可以利用如下的方法: 则代码如下:Ext.getCmp("textField" ...
- 通过CTAPI和Citect SCADA软件进行数据通讯
官方文档 Citect SCADA 7.20 Technical Reference 参考文献 基于Citect远程控制的变流量堆料控制系统 [王玉增,顾英妮,王维 济南大学,机械工程学院 ,Cite ...
- eclipse 启动tomcat报Spring错误 Error creating bean with name 'serviceOrderBiz': Injection of autowired dependencies failed
启动tomcat报异常,提示Sring无法创建serviceOrderBiz(第一行红字),继续看是因为有一个自动注入的字段无法注入ModuleInterfaceBiz(第二行红字),检查servic ...
- [BZOJ 1045] [HAOI2008] 糖果传递
题目链接:BZOJ 1045 Attention:数据范围中 n <= 10^5 ,实际数据范围比这要大,将数组开到 10^6 就没有问题了. 我们先来看一下下面的这个问题. 若 n 个人坐成一 ...
- 在ios7真机上和iOS6模拟器上运行是好的,而在iOS6真机上运行却报错
在ios7真机上和iOS6模拟器上运行是好的,而在iOS6真机上运行却报错 解决方法: 或是都设置为yes.. Build Active Architecture Only的意思是只生成适应的指令集