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;
}

Python多版本共存指南:用CMD命令一键切换3.6和3.8解释器(含pip使用技巧) 本文详细介绍了在Windows CMD环境下实现Python多版本(如3.6和3.8)共存与一键切换的完整方案。通过文件重命名策略、环境变量优化和自定义脚本,开发者可快速切换Python解释器版本,并管理各版本独立的pip依赖库,确保项目环境隔离与兼容性。 阅读详情

相关推荐

AFSim 2.9实战指南:从入门到精通的中文教程

本文是AFSim 2.9的实战指南,提供从零开始的中文教程。内容涵盖仿真环境搭建、实体行为控制、脚本编写,到传感器、武器系统集成与复杂想定构建,最后讲解数据记录与结果分析方法,帮助用户快速掌握这一强大的军事仿真框架。

weixin_29281941的博客 944

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

利用Arcgis提取nc数据并计算区域年均温

1.下载数据。2.解压数据至不含中文的路径中。打开工具箱中的多维分析工具-创建NetCDF栅格图层,导入数据。3.打开工具箱中的数据管理工具-图层和表视图-创建栅格图层,导入数据,对输出数据进行命名,得到月均温栅格数据。4.选择工具箱-Spatial Analyst工具(空间分析工具)-地图代数-栅格计算器,计算全国一年年均温。​5.将其导出为.tif格式数据,方便后期使用。6.选择工具箱-Spatial Analyst工具(空间分析工具)-区域分析--以表格显示分区统计,得到分区域的气温数据。

什么都学亿点点的博客 7992

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

在VM虚拟机的MobaXterm下安装JDK17

本文介绍了在Linux系统下安装配置JDK17的完整步骤:1)从Oracle或OpenJDK官网下载Linux版JDK17压缩包;2)上传至/usr/local目录;3)解压安装包;4)通过编辑/etc/profile文件配置环境变量,添加JAVA_HOME和PATH路径;5)使用source命令使配置生效;6)通过javac -version验证安装是否成功。整个过程涵盖了从下载到环境配置的完整流程,确保Java开发环境正确设置。

qq_2937655951的博客 442

Python、Selenium实现问卷星自动填写(内含适配个人问卷的方法)

使用Python、Selenium实现问卷星自动填写,内含适配个人问卷的方法。

DaenCode的博客 3837

POJ - 1503 Integer Inquiry (高精度加法

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

朝夕 435

一文详解脉搏血氧测量原理与方法

本文摘要:血氧饱和度(SpO2)是评估人体氧合功能的重要指标,反映血红蛋白携氧能力。其测量基于光电容积描记法(PPG),利用红光(660nm)和红外光(940nm)通过组织时的吸收差异计算。脉搏波特征与心血管状态相关,动脉硬化会影响波形特征。Masimo公司的信号提取技术(SET)通过并行算法有效解决了传统血氧仪在运动、弱灌注情况下的测量误差问题,显著提升了临床监测的准确性和可靠性。该技术已成为血氧监测的金标准,在降低误报率、缩短响应时间方面具有显著优势。

m0_50146396的博客 2014

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

STM32G474多通道ADC电压采集:软件触发与单次转换实战

本文详细介绍了STM32G474多通道ADC电压采集的实战方法,重点讲解了软件触发与单次转换的实现技巧。通过硬件设计、HAL库配置、多通道轮询采集及数据处理等环节的详细解析,帮助开发者高效完成精确电压采集任务。文章还提供了常见问题调试技巧和性能优化建议,适用于需要高精度电压监测的嵌入式应用场景。

weixin_28720767的博客 462

大语言模型在构建UNSPSC 分类数据中的应用

UNSPSC 是联合国标准产品和服务代码。本文研究如何利用大语言模型生成分类系统的分析

姚家湾博客 1860

大整数加法

题目描述    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

Qt+WebAssembly学习笔记(六)win10+Qt6.4.0rc1开发环境搭建

前言:因项目的缘故,笔者有段时间没测试了,官方也修复了很问题,笔者今天记录下最新版本环境搭建。

aggs1990的专栏 3766

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

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

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

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

递归_高精度运算_题目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

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

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、付费专栏及课程。

余额充值