HDU1013Digital Roots

代谢组数据分析(二十四):基于tidymass包从质谱原始数据到代谢物注释结果的实践指南 本教程介绍了如何使用 R 语言中的 tidymass 包进行代谢组学数据分析。tidymass 是一个专为液相色谱-质谱(LC-MS)数据设计的开源工具,提供从数据准备到统计分析的全流程支持。教程详细讲解了数据准备、数据处理、数据探索、数据清洗、代谢物注释、统计分析及结果输出的步骤。用户需准备 MS1、MS2 数据和样本信息表,并通过 tidymass 进行峰识别、峰分组、保留时间校正等操作。数据处理后,用户可进行数据探索、清洗和代谢物注释,最终通过统计分析发现潜在的生物标志物,并输出结果。教程还提供了代码 阅读详情

Digital Roots

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 65378    Accepted Submission(s): 20386


Problem Description
The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit.

For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yeilds 3, a single digit and also the digital root of 39.
 

Input
The input file will contain a list of positive integers, one per line. The end of the input will be indicated by an integer value of zero.
 

Output
For each integer in the input, output its digital root on a separate line of the output.
 

Sample Input
24 39 0
 

Sample Output
6 3
 
题目大意:
就是说超级数恩,什么是超级数,就是一个正整数所有位置的数求和,得到的数,如果是个位数那么这个 个位数就是超级数,如果不是个位数则需要将所得到的数的每个位置的数同上相加,直到得到的数字为个位数时,那么这个数就是该数的超级数;

分析:
题目要求对每个输入的正整数给出其超级数。刚开始的话我以为用 64位的整型就足够了,结果WA了,那么我就想到了,可以用字符串模拟改题,题目中给的数据将其每个位置的数加起来的值是会少于64位整型所能包括的数字,那么题目就很简单了,我只要在原来WA的代码的基础上,将输入的整型变成用字符串输入,然后将其所有的字符转换成整数并相加存到sum中,那么接下来就是处理很简单的整数的每个位置的相加就好了;

给出AC代码:
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	char str[10000];
	while (cin >> str)
	{
		if (str[0] == '0')break;
		int len = strlen(str);
		long long sum = 0, n;
		for (int i = 0; i < len; i++)
			sum += (long long)(str[i] - '0');
		while (sum >= 10 || sum == 0)
		{
			if (sum >= 10)
			{
				n = sum;
				sum = 0;
			}
			int x;
			while (n)
			{
				x = n % 10;
				n = n / 10;
				sum += x;
			}
		}
		cout << sum << endl;
	}
	return 0;
}



chromium通信系统-ipcz系统(二)-ipcz系统代码实现-同Node通信 在chromium通信系统-mojo系统(一)-ipcz系统基本概念一文中我们介绍了ipcz的基本概念。 本章我们来通过代码分析它的实现。 handle系统 为了不对上层api暴露太多细节,实现解耦,也方便于传输,ipcz系统使用handle表示一个对象,handle类似于文件描述符,用IpczHandle类型表示ipcz系统内的一个对象。一个可以用IpczHandle 句柄表示的对象必须是APIObject子类。APIObject数据结构如下 class APIObject : public RefCou 阅读详情

相关推荐

FPGA加速SNN实现MNIST手写数字识别的实践与优化

脉冲神经网络(SNN)作为第三代神经网络模型,采用生物启发的脉冲事件驱动机制,在处理时序信号时具有天然能效优势。其核心原理是通过神经元仅在接收足够输入脉冲时激活的稀疏特性,大幅降低计算能耗。在FPGA硬件加速领域,SNN通过量化优化、硬件友好型神经元模型设计等关键技术,可在边缘计算场景实现超高能效比。本文以MNIST手写数字识别为案例,详细解析了从6bit量化策略到双缓冲流水线设计的完整优化路径,最终在Xilinx Kintex-7平台实现97.54%识别准确率的同时,功耗仅231mW,能效比达81,712

weixin_30417487的博客 529

HDU 1013 Digital Roots(九余数定理 + 暴力解法)

Digital Roots The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed.

Defepe 337

MFC界面库BCGControlBar v32.0 - 对话框、仪表盘控件升级

亲爱的BCGSoft用户,我们非常高兴地宣布BCGControlBar Professional for MFC和BCGSuite for MFCv32.0正式发布!新版本支持Windows 11、增强功能区简化模式、改进控件外观等,以及其他新功能和改进。需要最新版的可以点击这里【BCG下载】 BCGControlBar Pro for MFC v32.0正式版下载 对话框和表单 1. 添加了一个新的全局标志globalData.m_bAutoPrepareComboListStyles:如果您希望.

需要界面开发、IDE工具研发中文教程资料的小伙伴,记得私信我~ 1147

ACM刷题之HDU————Digital Roots

Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 66926    Accepted Submission(s): 20908 Problem Description The digita

小时的枫的博客 572

LangChain与SkillLite集成:AI Agent安全沙箱实践

在AI与自动化技术领域,安全沙箱是实现可信计算的核心机制。其原理是通过资源隔离与权限控制,构建受限的执行环境。技术价值在于平衡功能开放性与系统安全性,尤其适用于处理用户提交的非受信代码或敏感数据。典型应用场景包括AI插件系统、在线代码评测平台等。本文以LangChain框架与SkillLite沙箱的深度集成为例,详解如何通过命名空间隔离、cgroups限制等机制,为AI Agent赋予安全执行动态技能的能力。其中涉及的关键技术点包括Python运行时隔离、动态资源配额管理,以及如何防范Shell注入等常见攻

weixin_34189116的博客 405

MyBatis示例

MyBatis示例 基本示例 环境准备 jdk : 1.8.0 MyEclipse MySQL MyBatis-3.4.6.jar 新建JavaWeb Project 命名:mybatis 导入JAR包或添加POM.xml中添加依赖 MyBatis_config.xml &amp;amp;amp;amp;amp;lt;?xml version=&amp;amp;amp;amp;quot;1.0&amp;amp;amp;amp;quot; encoding=&a

走在命运的左岸 721

杭电acm1013 Digital Roots 数字根 Java解法 高精度

【代码】杭电1013 Digital Roots 数字根。

多多的博客 12万+

【图像超分】论文精读:SRConvNet: A Transformer-Style ConvNet for Lightweight Image Super-Resolution

本文提出了一种轻量级图像超分辨率重建方法SRConvNet,结合了卷积神经网络和Transformer的优势。针对传统Transformer计算复杂度高的问题,设计了傅立叶调制注意力(FMA)替代自注意力机制,通过区域频率空间调制实现高效的全局依赖建模;同时引入动态混合层(DML),采用混合尺度动态卷积结合通道拆分机制增强局部特征提取。实验表明,SRConvNet在计算效率和参数数量上显著优于现有轻量级超分方法,同时保持了优异的重建性能。该方法为移动端部署提供了有效的解决方案,在精度与复杂度间取得了良好平衡

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 808

hdu 【1013】Digital Roots

Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 66831    Accepted Submission(s): 20880 Problem Description The digital ro

你真的介意真的在乎真的想要真的渴望的话你一定能够做到 980

lammps教程:官方自带eam_database程序拟合EAM势方法介绍

使用lammps模拟金属体系,最常用的势函数为eam、meam势。 对于大多数金属或者合金来说,可以从网上下载相对应的eam或meam势力场文件。 而对于一些新的合金材料,可能就找不到相对应的力场文件。 解决的方法有两种,一是采用混合势(pair_style hybrid),第二种方法是自己拟合势函数文件。 混合势的写法在前面文章中已经介绍过,本文介绍一种拟合EAM势的方法。 该方法是运行Xiaowang Zhou编写的一个拟合程序,该程序可自动生成所需要的合金势。 这个程序能够拟合的合金元素有: Cu,

lammps_jiayou的博客 4615

双端之Nginx+Php结合PostgreSQL搭建Wordpress

制作的 PG4WP 分支版本,它与所有版本的 WordPress 兼容,解决了原版的一些问题。参数,确保 PostgreSQL 正在监听默认端口(通常是 5432),或者你自定义的端口。:PG4WP 插件存在缺陷和不完整的功能,可能与最新版本的 WordPress 不兼容。的插件,它允许 WordPress 使用 PostgreSQL 数据库。,如果看到 Nginx 的默认欢迎页面,说明 Nginx 已正确安装。,如果看到 Nginx 的默认欢迎页面,说明 Nginx 已正确安装。

宇宙第一小趴菜的博客 1891

HDU_1013 Digital roots

Digital Roots HDU - 1013 The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resu...

yft1023的博客 248

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

HDU1013 Digital Roots

题目:HDU1013        题意为读入一个整数求他的Digital Roots         注意:读入的整数可能很长,用int ,long long可能都会WA,考虑使用字符串。       方法一:每读入一个字符,将其转化为数字后与sum相加,sum为最后的结果。                     代码:#include #include using namespace

师者为王 2606

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

hdu 1013 Digital Roots

hdu 1013 Digital Roots The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the result...

博客——XiaoTang 255

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

【基础题】HDU1013 Digital Roots

题目 HDU1013 Digital Roots 题目分析 这个题就是求一个数的数根,就是计算各个位上数字的和,如果和是个位数,那么数根就是这个个位数,否则就重复这种计算直至各个位上数字之和为个位数。比如39->3,9->12->1,2->3,所以39的数根为3。 解这个题用到了数论当中的九余数定理,就是一个数除以9的余数与这个数各个位数数字之和除以9的余数相等。我们可以知...

vxiao_shen_longv的博客 291

hdu1013 (Digital Roots)

hdu1013 (Digital Roots) 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting v...

weixin_41568105的博客 267

hdu1013 Digital Roots

热烈庆祝本人于2013.1.22正式开张,路过的都顶啊!     本题是hdu1013   Digital Roots  .原题地址http://acm.hdu.edu.cn/showproblem.php?pid=1013  .题意简单明了的一道水题,就是让你把输入的数每一位数字相加,得数再做如此操作,直到只剩一位时输出结果.     测试样例可能会很大,整形必然存不下,所以考虑怎么扩长.

slicer的技术交流栈 670

hdu-1013 Digital Roots

题目来源:hdu-1013 Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 59825 Accepted Submission(s): 18723 Problem Description

暮光乐鱼的博客 550

【HDU】1013 Digital Roots

【代码】【HDU】1013 Digital Roots。

多言数穷,不如守中。十语九中,未必称奇;一语未中,愆尤骈集。 578

HDU 1013 Digital Roots

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1013

mullerwch的专栏 550

hdu1013Digital Roots

Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 91251    Accepted Submission(s): 28397http://acm.hdu.edu.cn/showproblem...

一只秀逗__的博客 242

HDU 1013 Digital Roots

 Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulti

Czy 1140
上一篇: HDU1008 Elevator
下一篇: HDU1020 Encoding
abner_Tan
博客等级 码龄11年 18粉丝 70原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值