hdu1178(简单公式)

开发者福利!热门AI工具限时免费用 购周边即赠Coding Plan Lite,Claude Code、Cursor等20+工具畅享,效率翻倍! 阅读详情

题目链接:Heritage from father

计算




#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
    //freopen("in.txt","r",stdin);
    double n;

    while(scanf("%lf",&n)!=EOF&&n){
        double tmp=n*(n+1)*(n+2)/6;
        int e=(int)log10(tmp);
        double x=tmp/pow(10,e);
        printf("%.2lfE%d\n",x,e);
    }

    return 0;
}


Hdu1178Heritage from father Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 5118    Accepted Submission(s): 1811 Problem Description Famous Harry Potter,who se 阅读详情

相关推荐

联想ThinkPad声卡驱动安装避坑指南:从E470到X1 Carbon的通用解法

本文详细介绍了ThinkPad声卡驱动安装的全流程,从硬件识别到驱动获取、安装技巧及深度排错。涵盖E470到X1 Carbon等不同机型的通用解法,帮助用户解决音频驱动问题,提升使用体验。重点讲解了声音驱动的精准识别和安装策略,确保系统稳定运行。

weixin_29207439的博客 664

hdu---1178Heritage from father

Heritage from father Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 4686    Accepted Submission(s): 1665 Problem Description Famous Harry

搬家啦x 649

SystemRDL:从寄存器描述到自动化生成的完整指南

本文详细介绍了SystemRDL如何通过“一份描述,多处生成”的理念,彻底解决芯片与FPGA设计中手动维护寄存器带来的不一致与低效问题。文章提供了从语言快速上手、核心组件讲解到使用PeakRDL工具链实现自动化代码与文档生成的完整实战指南,帮助硬件工程师构建高效、可靠的寄存器开发流程。

weixin_29243279的博客 589

hdu1178(科学记数法)

#include int main() { double sum; int k,n; while(scanf("%d",&n)==1&&n) { k=0; sum=(n+1)*1.0*n/6.0*(n+2);//必须用n/6.0才能过 while(sum>=10) {

青山绿水之辈 专栏 1199

hdu1178)Heritage from father

水题,主要考察了一个数学公式; #include int main() {     int m,k;     double n;     while(scanf("%d",&m),m)     {         n=1.0*m*(m+1)*(m+2)/6.0;         k=0;         while(n>=10)         {            

飞雪---晨 766

hdu 1178 Heritage from father

这道题是基本的输出格式问题,还是那句话细节决定成败。 代码 1 #include<stdio.h> 2 #include<math.h> 3 4 int main() 5 { 6 __int64 s,t; 7 double p,q; 8 while(scanf("%I64d",&s)!=EOF&&s) 9 ...

weixin_30363981的博客 112

hdu 1178

此題有纪念意义:如果两个int数很大,结果需要放到double型里面, 那么第一步请先乘以 1.0,转化成double型否则可能中间结果溢出,导致得不到正确答案 比如 int n; // n可能很大, double sum=0; sum=n*(n+1)*(n+2)/6.0; 如果我们不在第一步乘以1.0,那么n*(n+1) 可能就已经溢出,结果自然是错误的,所以正确的写法是。sum=1.0*n*

the_conquer_zzy的专栏 339

杭电acm1178

http://acm.hdu.edu.cn/showproblem.php?pid=1178 这题关键在于推导出通项公式为i*(i+1)/2的前n项和, 由于n(n+1)=[n(n+1)(n+2)-(n-1)n(n+1)]/3所以1*2+2*3+...+n(n+1)=[1*2*3-0+2*3*4-1*2*3+....+n(n+1)(n+2)-(n-1)n(n+1)]/3[前后消项]...

anccx84886的专栏 123

HDU 1178 Heritage from father 数学公式 JAVA

题意:求∑ni=1i∗(i+1)2\sum_{i=1}^{n}\frac{i*(i+1)}{2},并用科学计数法保留3位小数表示出来。思路:写出公式即可:∑ni=1i(i+1)2=12∑ni=1(i2+i)=12[n(2n+1)(n+1)6+i(i+1)2]\sum_{i=1}^{n}\frac{i(i+1)}{2}=\frac{1}{2}\sum_{i=1}^{n}(i^2+i)=\frac{1}

NM的专栏 506

hdu 1178

http://acm.hdu.edu.cn/showproblem.php?pid=1178 等差求和公式s=n(n+1)/2=n/2+n^2/2。。。 sum=1+3+6+………………+i(i+1)(i+2)/6 =1+(1+2)+(1+2+3)+…………(1+2+3+……n) =1/2+1^2/2+2/2+2^2/2+…………n/2+n^2/2 =n(n+1)/2/2+n(n+1)(...

weixin_30575309的博客 123

hdu1178

求1,3,6,10,15,21,28……(n*()

穿袜子的流氓兔的专栏 769

HDU1178 Heritage from father【水题】

Heritage from fatherTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 6899    Accepted Submission(s): 2584Problem DescriptionFamous Harry Potter,...

海岛Blog 1100

HDU 1178 Heritage from father

数学题,数列 #include #include #include using namespace std; int main() { double n; while(scanf("%lf", &n) != EOF && n) { double x = log10(n/6.0) + log10(1.0* (n+1)) + log10(1.0

Reluxer 674

【求和公式+科学计数法+求数字位数】HDU-1178 Heritage from father

注解 1、本题是求1+3+6+…+N(N+1)/2的和,其求和公式为N*(N+1)*(N+2)/6。推导过程如下: 1 * n + 2 (n - 1) + 3 (n - 2) + …… + (n - 2) * 3 + (n - 1) * 2 + n * 1 = 1 * (n + 1 - 1) + 2 (n + 1 - 2) + 3 (n + 1 - 3) + …… + (n - 2) * (n...

zhanggirlzhangboy的博客 448

hdu1178——Heritage from father

Problem Description Famous Harry Potter,who seemd to be a normal and poor boy,is actually a wizard.Everything changed when he had his birthday of ten years old.A huge man called 'Hagrid' found Harr

Beyond the Sora 763

HDU 1178Heritage from father

Heritage from father Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131070/65535K (Java/Other) Total Submission(s) : 73   Accepted Submission(s) : 26 Font: Times New Roman | Verdana | Geor

657

nyoj 1178 && hdu 5105 Math Problem 求解一元二次三次方程

题目链接:http://acm.nyist.net/JudgeOnline/problemrank.php?pid=1178 题目就是一个简单的高中物理问题,题目意思是:人A以初速度v0,加速度a0,追人B以初速度v1,加速度a1,最开始相距x,且B在前,A在后。问多少秒能追上? 这就是一个简单的高中物理追击问题。 我使用是一元二次方程解的这道题。但是,也遇到了一些了问题。

963

hdu1178数学题 Heritage from father

Heritage from father Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 5859    Accepted Submission(s): 2107 Problem Description Famous H

Winjourn的专栏 959
上一篇: hdu1176(DP)
下一篇: hdu1180(BFS)
pmt123456
博客等级 码龄12年 74粉丝 165原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值