hdu 4473 Exam 数学
思路:
将条件转化为满足abc<=n的abc的数目。
1.3个数相等时,为 A;
2.有2个数相等时,为 B;
3.都不相等时,为 C。
则结果为A+3*B+6*C。
代码如下:
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<vector>
#define ll __int64
using namespace std;
int main(){
ll n,m,ans,i,j,k,v;
int c=;
while(scanf("%I64d",&n)!=EOF){
m=(ll)pow(n,1.0/);//i=j=k
ans=m;
if((m+)*(m+)*(m+)==n) ans++;
for(i=;i<=m;i++){
v=(ll)sqrt(n/i);
ans+=(n/(i*i)-i+v-i)*;//i=j , j=k
for(j=i+;j<=v;j++){
ans+=(n/(i*j)-j)*;//i!=j!=k
}
}
printf("Case %d: %I64d\n",++c,ans);
}
return ;
}
hdu 4473 Exam 数学的更多相关文章
- HDU 4473 Exam 枚举
原题转化为求a*b*c <=n中选出两个数组成有序对<a,b>的选法数. 令a<=b<=c.... 分情况讨论: (1)全部相等,即a = b = c. 选法有n^(1/ ...
- HUD 4473 Exam
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4473 题目意思 定义f(x) = 满足(a * b)|x的有序对(a,b)的个数. 然后输入一个n, ...
- HDU 5673 Robot 数学
Robot 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5673 Description There is a robot on the origi ...
- HDU 5914 Triangle 数学找规律
Triangle 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Description Mr. Frog has n sticks, who ...
- CF Exam (数学)
Exam time limit per test 1 second memory limit per test 256 megabytes input standard input output s ...
- HDU 2493 Timer 数学(二分+积分)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2493 题意:给你一个圆锥,水平放置,圆锥中心轴与地面平行,将圆锥装满水,在圆锥某一表面开一个小洞,流出来 ...
- HDU 1568 Fibonacci 数学= = 开篇
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1568 分析:一道数学题 找出斐波那契数列的通项公式,再利用对数的性质就可得到前几位的数 斐波那契通项公 ...
- hdu 4602 Partition 数学(组合-隔板法)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4602 我们可以特判出n<= k的情况. 对于1<= k<n,我们可以等效为n个点排成 ...
- HDU 1030 Delta-wave 数学题解
给出一个数字塔,然后求沿着数字之间的边走,给出两个数字,问其路径最短的长度是多少. 看似一条搜索题目,只是有一定做题经验的人都知道,这个不是搜索题,直接搜索肯定超时. 这个是依据规律计算的数学题目. ...
随机推荐
- linux 下权限问题
linux 系统下的文件权限 drwxr-xr-x. 2 weblogic weblogic 4096 Dec 26 2012 console-ext-rwxr-xr-x. 1 weblogic we ...
- VIM中的寄存器简介
原来在vim粘贴从其他地方复制过来的文本的时候,一直用的shift + inert,那时就想,能不能够直接就像p那样粘贴,不必非得进入插入模式再来粘贴.后来看了<vim实用技巧>上关于vi ...
- 用CSS实现Firefox 和IE 都支持的Alpha透明效果
有的时候,为了实现一些特殊效果,需要将页面元素变透明,本文介绍的就是用 CSS 实现 Firefox 和 IE 都支持的 Alpha 透明效果.CSS: filter:alpha(opacity=50 ...
- 百度云demo2
- Oracle varchar2 4000
关于oracle varchar2 官方文档的描述 VARCHAR2 Data Type The VARCHAR2 data type specifies a variable-length char ...
- itertools模块速查
学习itertools模块记住这张表就OK了 参考:http://docs.python.org/2/library/itertools.html#module-itertools Infinite ...
- Allegro中板子边框不封闭导致的z-copy无法用的问题
画一个不规则的边框,有半圆形状,导致边框不封闭,无法使用Z-COPY命令,下边是解决办法: 1 画好Outline后,选择 shape -> Compose Shape , options选项卡 ...
- SQLserver利用系统时间生成“2015-11-30 00:00:00.000”类型的时间
select getdate() ---当前时间:2015-12-18 10:20:24.097 -------------------建立测试表 Create Table #Test ( ID IN ...
- access_ok()
access_ok() 函数是用来代替老版本的 verify_area() 函数的.它的作用也是检查用户空间指针是否可用. 函数原型: access_ok (type, addr, size); 变量 ...
- When to use Class.isInstance() & when to use instanceof operator?
I think the official documentation gives you the answer to this one (albeit in a fairly nonspecific ...