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 ...
随机推荐
- Smarty include
注:由于水平有限,欢迎指正.转载请务必注明出处. 1 include Attribute Name Type Required Default 描述 file string Yes n/a T ...
- beanutils中类型转换
public void doPost(HttpServletRequest request, HttpServletResponse response) throws Servl ...
- SignalR 2.0 入门与提高
SignalR 2.0 入门与提高 SignalR 2.0 最近整理了SignalR2.0 部分知识点,原文翻译,由于自己是土鳖,翻译得不好的地方,欢迎指正!仅供各位初学者学习! 第一节. 入门ASP ...
- Foundation 学习笔记
笔记内容 学习笔记-段玉磊 Stanford course Foundation and Attributed Strings Dynamic binding id 是一个指向任何未知对象的指针,(t ...
- Light, more light - PC110701
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva10110.html 原创:Ligh ...
- Binder机制,从Java到C (2. IPC in System Service :AMS)
1.建立Activity和Service的IPC之前 在上一篇 Binder机制,从Java到C (1. IPC in Application Remote Service) 里面有说到Activi ...
- Repeater 模板中查找子控件
前言:对于Repeater控件,相信从事NETWeb开发的同仁们再熟悉不过了.因其呈现方式和Literal一样,并不在前端生成任何表单标签元素,所以属于比较轻量级的控件.不过青睐于Repeater的主 ...
- 用PowerShell代替批处理吧!
这篇文章主要介绍了用PowerShell代替批处理吧!本文讲解了批处理文件的历史.Windows NT 和 Cmd.exe.Windows Script 主机.进入 Windows PowerShel ...
- Python之路 1Day
1.python基础入门 作者:黄旭 提示: 语法基于python3.5版本(会提示2.7版本和3.5版本的区别) Python命令行将以>>>开始,比如 >>> ...
- 搭建Ubuntu12.04交叉编译服务器
最近在公司学着搭建一台Linux服务器作为交叉编译的主机之用,服务器端选择了Ubuntu12.04 LTS桌面版,客户端采用Windows XP平台,使用SSH工具软件putty登录到Linux主机, ...