FZU 2104 (13.11.28)
来源:互联网 发布:软件开发项目进度 编辑:程序博客网 时间:2024/06/05 06:40
Problem 2104 Floor problem Accept: 376 Submit: 433
为高教杯复习而做,水题
直接贴AC代码:
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)
- FZU 2104 Floor problem
- FZU - 2104 Floor problem
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- FZU
- ubuntu下编译libfaac 1.28遇到错误: mpeg4ip.h:126:58: error: new declaration ‘char*
- #2013年Google官方技术求职大礼包#面试求职技巧篇
- 下拉加载更多
- 第十四周项目一 数组大折腾3
- 异步请求之跨域名异步文件上传iframe标签
- FZU 2104 (13.11.28)
- Libsvm和Liblinear的比较
- 静态路由的Reject、Blackhole及Null属性有什么区别
- 第15周项目3-字符操作函数版
- 周鸿祎:《拒绝平庸》—清华演讲
- UIViewController的生命周期
- 大学英语六级听力——018(Good teachers)
- 计算大小字符分别出现的次数
- (完本)成绩处理之大结局~