POJ – 1503 Integer Inquiry Integer Inquiry

POJ1503-Integer Inquiry 北大POJ1503-Integer Inquiry 解题报告+AC代码 立即下载

POJ –1503 Integer Inquiry

Integer Inquiry

Time Limit: 1000MS

Memory Limit: 10000K

Total Submissions: 34728

Accepted: 13523

Description

One of the firstusers of BIT's new supercomputer was Chip Diller. He extended his explorationof powers of 3 to go from 0 to 333 and he explored taking various sums of thosenumbers. 
``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were hereto see these results.'' (Chip moved to a new apartment, once one becameavailable on the third floor of the Lemon Sky apartments on ThirdStreet.) 

Input

The input willconsist of at most 100 lines of text, each of which contains a single VeryLongInteger.Each VeryLongInteger will be 100 or fewer characters in length, and will onlycontain digits (no VeryLongInteger will be negative). 

The final input line will contain a single zero on a line by itself. 

Output

Your programshould output the sum of the VeryLongIntegers given in the input.

Sample Input

123456789012345678901234567890

123456789012345678901234567890

123456789012345678901234567890

0

Sample Output

370370367037037036703703703670

大数加法----》直接用java中的BigInteger应该时最快的方法,不过我这里通过数组实现:

将大数的每位分配到数组中的每一位然后相加。

 

代码:

//poj 1503 Integer Inquiry
#include <cstdio>
#include <cstring>
const int max = 200;
int main(int argc,char const *argv[])
{
    //freopen("in.txt","r", stdin);
    int sum[max];
    memset(sum,0, sizeof sum);
    char line[150];
    //waring the gets
    while (gets(line)&& !(line[0]== '0'&&line[1]== '\0')){
        int s =0, c= 0;
        int n =0, j= max -1;
        while (line[n++]);
        n -= 2;
        while (n >= 0) {
            int tmp = line[n]- '0';
            s = sum[j]+ tmp + c;
            c = s/ 10;
            sum[j]= s %10;
            n--; j--;
        }
        while (c) {
            s = sum[j]+ c;
            c = s/ 10;
            sum[j--]= s %10;
        }
    }
    for (int i =0; i< max; i++){
        if (sum[i]){
            for (; i < max; i++)
                printf("%d", sum[i]);
        }
    }
    printf("\n");
    return 0;
}

开源代码分享(29)-基于拉丁超立方抽样的风光场景生成和削减 作为分层抽样方法的一 种,拉丁超立方抽样具有良好的抽样精度和效率[14]。本文使用多场景方法来描述可再生能源(风电、光伏)的不确定性。以风电功率为例,首先假定风电功率服从正态分布 N(μ, δ 2 ),μ 为预测值的期望值,δ 为其波动的百分比。接着,采用拉丁超立方抽样[21]生成大量服从概率分布约束的风电出力场景,并采用考虑 Kantorovich 距离[22]的场景削减技术处理该场景,进行场景削减。最后,导出具有相应概率的削减之后的场景。 阅读详情

相关推荐

LNA设计学习心得记录----MOS管的选取

LNA设计学习心得---MOS管的选取仿真

weixin_40359668的博客 6127

POJ 1503 Integer Inquiry 【大数加法】

Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.``Th...

weixin_34360651的博客 383

4D毫米波雷达

详解4D成像毫米波雷达

sangba2019的博客 2393

uva 424 - Integer Inquiry

One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers. ``This superc

uva code 1111

银河麒麟V10离线环境下的Python项目迁移:从Windows依赖到ARM架构适配

本文详细介绍了在银河麒麟V10离线环境下将Python项目从Windows迁移到ARM架构的完整流程。重点讲解了离线安装pip、virtualenv等基础工具的方法,以及如何解决ARM架构兼容性问题,确保项目依赖正确迁移。文章还提供了常见问题解决方案和性能优化建议,帮助开发者顺利完成国产化平台适配工作。

weixin_42639246的博客 423

Goose开源程序本地机上 AI 代理,能够从头到尾自动执行复杂的开发任务。Goose 不仅可以提供代码建议,还可以自主构建整个项目、编写和执行代码、调试故障、编排工作流程以及与外部 API 交互

Goose开源程序 是您的本机上 AI 代理,能够从头到尾自动执行复杂的开发任务。Goose 不仅可以提供代码建议,还可以自主构建整个项目、编写和执行代码、调试故障、编排工作流程以及与外部 API 交互。无论您是在构建想法原型、优化现有代码,还是管理复杂的工程管道,goose 都能适应您的工作流程并精确执行任务。

struggle2025的博客 2041

POJ - 1503 Integer Inquiry (高精度加法

高精度加法,再来复习一下,一开始读的很懵,不过万变不离其宗,题意是就是不断输入数求累加和,然后遇0结束。 两星期之前做的了,现在有点写不出来 嗯…某些关键的步骤确实忘了,比如把字符数组倒置转换进整形数组… 最后保证效率,看了看以前的代码写出来了。希望以后会记住吧! #include <iostream> #include <cstring> #include <cs...

朝夕 435

VMware Converter 6.2.0保姆级教程:从物理机到ESXi主机的完整迁移指南(含常见错误排查)

本文提供VMware Converter 6.2.0从物理机迁移至ESXi主机的完整保姆级教程。详细解析了迁移前的环境规划、核心转换过程步骤、版本差异对比,并重点针对代理安装失败、任务卡顿、虚拟机无法启动等常见错误提供了实战排查与解决方案,确保P2V迁移顺利进行。

sam99的博客 380

poj 1503Integer Inquiry(高精度 水题)

为啥同一代码G++和C++提交的相差这吗大呢… #include #include using namespace std; int main() { string str; int len, max=0, i, j; int sum[103]={0};

tanhaiyuan 949

使用libVLC进行视频截图的C/C++实现

通过这些代码,你可以在C/C++应用程序中实现视频截图功能,并将视频帧保存为图像文件。请注意,本文只提供了基本的示例代码,你可以根据自己的需求进行扩展和修改。libVLC是一个强大的开源多媒体框架,可以用于在C/C++应用程序中处理和播放音频和视频文件。我们将展示如何初始化libVLC,打开视频文件,捕获视频帧并保存为图像文件。在开始编写代码之前,你需要包含libVLC的头文件,并链接相应的库文件。在链接阶段,你需要添加libVLC库的链接选项。在使用libVLC之前,你需要初始化libVLC的实例。

学习使你进步。 470

用 CL_SALV_TREE 把层级数据做成一棵会呼吸的 ABAP ALV 树:从类继承扫描到事件交互的完整拆解

本文介绍了SAP ABAP中使用CL_SALV_TREE实现树形ALV报表的方法。该技术将层级数据(如类继承关系)以可展开/折叠的树形结构展示,解决了传统ALV Grid无法直观显示层次结构的问题。核心实现采用"数据表+层级表"分离的设计模式:数据表存储节点业务信息,层级表维护父子关系。通过add_node方法动态构建树形结构,支持设置节点文本、图标和事件。文中提供了完整示例代码,演示了如何递归扫描ABAP类继承关系并构建树形ALV,这种技术特别适用于展示类族谱、权限树等层级数据,能显著

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 206

大整数加法

题目描述    One of the first users of BIT's new supercomputer was Chip Diller.     He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.     ...

qq_38030194的博客 270

802.11be 的“上帝视角”:深入解析 CSI 技术原理与实现

IEEE 802.11be标准下的CSI技术解析 摘要:本文深入解析了802.11be标准中的信道状态信息(CSI)技术。CSI作为无线通信的"高精度地图",通过显式反馈机制获取信道矩阵H,经SVD分解得到预编码矩阵V。802.11be在CSI反馈机制上实现重大改进:支持320MHz带宽、16空间流;引入灵活的子载波分组(Ng=4/16)、更高量化精度(最高9/7比特)、部分带宽反馈和触发式反馈。这些创新显著提升了MU-MIMO和波束成形性能,为Wi-Fi 7带来极速通信、精准感知和Me

1042484520@qq.com(邮箱) 209

UVA - 424 Integer Inquiry

Integer Inquiry  One of the first users of BIT's new supercomputer was Chip Diller. Heextended his explorationof powers of 3 to go from 0 to 333 and he explored taking various sumsof those

Jvc__的专栏 629

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

poj1503 Integer Inquiry (大数相加)

C - Integer Inquiry Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1503 Appoint desc

苏苏爱自由 1866

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

递归_高精度运算_题目1119:Integer Inquiry

时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:341 解决:174 题目描述:     One of the first users of BIT's new supercomputer was Chip Diller.     He extended his exploration of powers of 3 to go from

Denallo的专栏 2430

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

POJ-1503 Integer Inquiry-多个大数相加

Integer Inquiry Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 31808   Accepted: 12404 Description One of the first users of BIT's new supercomputer was Chip

Some. 680

九度OJ 1119 Integer Inquiry

题目描述:     One of the first users of BIT's new supercomputer was Chip Diller.     He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers

Jaster_wisdom的专栏 786

CSU-ACM2019寒假训练1-G - 相当简单题

这道题相当不错欸,大数字运算的处理方式,学到了(ง •_•)ง 题目: One of the first users of BIT’s new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sum...

扬弃 431

【大数加法】POJ 1503 Integer Inquiry

 POJ 1503 Integer Inquiry题目链接——&gt;点击打开链接Integer InquiryTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 35569 Accepted: 13869DescriptionOne of the first users of BIT's new supercomputer was ...

荷叶田田 494

大数系列——Integer Inquiry

Integer Inquiry One of the first users of BIT's new supercomputer was Chip Diller. Heextended his explorationof powers of 3 to go from 0 to 333 and he explored taking variou...

weixin_30632883的博客 160

第六周集训例题总结

高精度计算 Integer Inquiry One of the first users of BIT’s new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those num...

qq_44947296的博客 1407

hduoj1047,Integer Inquiry,大数加法,跟poj某一题一样,再谈

Integer Inquiry Problem Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various s

/ 554

Integer Inquiry

Problem Description  One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those n

清风笑 801

POJ 1503 Integer Inquiry(大数相加)

一、Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those n...

a136358的博客 169

POJ--1503:Integer Inquiry 大数加法

题目源地址:http://poj.org/problem?id=1503 程序源代码:

酒酿小圆子呀~ 839
上一篇: POJ 2739 Sum of Consecutive Prime Numbers
下一篇: poj 3006 Dirichlet's Theorem on Arithmetic Progressions
朔北冥
博客等级 码龄11年 14粉丝 27原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值