hdu 4342 History repeat itself(数学题)
题目链接:hdu 4342 History repeat itself
题意:
让你找第a个非完全平方数m,并且求前m个数的开方向下取整的和。
题解:
第一个问题:
#include<bits/stdc++.h>
#define F(i,a,b) for(int i=a;i<=b;++i)
using namespace std; int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long a,ans1,ans2,n;
scanf("%lld",&a);
n=ceil((+sqrt(+*a))/)-;
ans1=n+a;
ans2=;
F(i,,n)ans2+=(long long)(*i-)*(i-);
printf("%lld %lld\n",ans1,ans2+(a+n-n*n+)*n);
}
return ;
}
hdu 4342 History repeat itself(数学题)的更多相关文章
- HDU 4342——History repeat itself——————【数学规律】
History repeat itself Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. O ...
- 二分查找+数学 HDOJ 4342 History repeat itself
题目传送门 题意:计算从1开始到第n个非完全平方数的开方和 分析:设第n个非完全平方数的值为a,x * x < a < (x+1) * (x+1),而且易得(tmp = sqrt (a) ...
- 2012 #5 History repeat itself
History repeat itself Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- 【HDU - 4342】History repeat itself(数学)
BUPT2017 wintertraining(15) #8C 题意 求第n(n<2^32)个非完全平方数m,以及\(\sum_{i=1}^m{\lfloor\sqrt i\rfloor}\) ...
- hdu 1299 Diophantus of Alexandria(数学题)
题目链接:hdu 1299 Diophantus of Alexandria 题意: 给你一个n,让你找1/x+1/y=1/n的方案数. 题解: 对于这种数学题,一般都变变形,找找规律,通过打表我们可 ...
- HDU 1018 Big Number (数学题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1018 解题报告:输入一个n,求n!有多少位. 首先任意一个数 x 的位数 = (int)log10(x ...
- HDU 2529 Shot (物理数学题)
题目 解题过程: //物理数学题 #include<stdio.h> #include<string.h> #include<algorithm> using na ...
- HDU 5584 LCM Walk(数学题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5584 题意:(x, y)经过一次操作可以变成(x+z, y)或(x, y+z)现在给你个点(ex, e ...
- hdu 4970 Killing Monsters(数学题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4970 Problem Description Kingdom Rush is a popular TD ...
随机推荐
- 正则表达式测试分析工具Expresso
正则表达式测试分析工具Expresso 一个正则表达式的小工具--myRegexHelper 把以前做的一个功能抽取出来做成一个小的正则表达式测试工具.没什么特色,有两点功能: 一.方便的测试正则 ...
- Linux下监控磁盘空间的四个命令
无论是运行简单的Linux桌面还是大型Linux服务器,都需要了解可供应用程序使用的空间,并跟踪系统的磁盘使用情况.下面介绍四个核心命令行命令来管理Linux系统上的介质环境. 一.mount命令 m ...
- C#开发ActiveX控件
昨天写了篇博客<Winform 程序嵌入WPF程序 并发送消息>,没有说明为什么要嵌入WPF程序,那么今天就来唠叨唠叨其中的一个使用场景,开发ActiveX控件 首先,新建一个类库工程Hu ...
- 10.25最后的模拟赛DAY1 answer
QAQ太困了,大概说一下自己的思路: 其实这题很容易看错题目或是想错,就比如我个傻逼,一开始以为p+q一定等于n.... 咳咳...其实这题不用想太多,我们可以通过这n个字符串一个个假设正确或是不正确 ...
- 网络负载均衡环境下wsHttpBinding+Message Security+Windows Authentication的常见异常
提高Windows Communication Foundation (WCF) 应用程序负载能力的方法之一就是通过把它们部署到负载均衡的服务器场中. 其中可以使用标准的负载均衡技术, Windows ...
- HashTable和HashSet中的类型陷阱
HashTable和HashSet中的类型陷阱 发现这个陷阱的起因是这样的:我现在有上百万字符串,我准备用TopK算法统计出出现次数做多的前100个字符串. 首先我用Hashtable统计出了每个字符 ...
- TPL相关
C#中的Timer System.Windows.Forms.TimerSystem.Threading.Timer System.Timers.Timer 1.System.Windows.Form ...
- IE8下提示'console'未定义错误
在开发的过程中由于调试的原因,在代码中加入console.info("xxxx"),而未进行删除 在IE8下测试该代码所在的页面报错,如下: 需要注意的是,使用console对象查 ...
- CNN for Visual Recognition (assignment1_Q1)
参考:http://cs231n.github.io/assignment1/ Q1: k-Nearest Neighbor classifier (30 points) import numpy a ...
- linux学习之linux的hostname修改详解《转》
linux的hostname是一个kernel变量,可以通过hostname命令来查看本机的hostname.也可以直接cat /proc/sys/kernel/hostname查看. #hostna ...