hdu-1163(九余数定理)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1163
思路:
九余数定理:一个数对九取余的结果叫做九余数,
一个数的各个位数相加的得到的小于10的数也叫九余数
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(void)
{
int n,tp,i;
while(~scanf("%d",&n)&&n)
{
tp=;
for(i=;i<n;i++)
tp=tp*n%;
printf("%d\n",tp==?:tp);
}
return ;
}
hdu-1163(九余数定理)的更多相关文章
- hdu 1163 九余数定理
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- hdu 1163 Eddy's digital Roots 【九余数定理】
http://acm.hdu.edu.cn/showproblem.php?pid=1163 九余数定理: 如果一个数的各个数位上的数字之和能被9整除,那么这个数能被9整除:如果一个数各个数位上的数字 ...
- HDOJ 1163 Eddy's digital Roots 九余数定理+简单数论
我在网上看了一些大牛的题解,有些知识点不是太清楚, 因此再次整理了一下. 转载链接: http://blog.csdn.net/iamskying/article/details/4738838 ht ...
- HDOJ 1163 Eddy's digital Roots(九余数定理的应用)
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
- HDU1013,1163 ,2035九余数定理 快速幂取模
1.HDU1013求一个positive integer的digital root,即不停的求数位和,直到数位和为一位数即为数根. 一开始,以为integer嘛,指整型就行吧= =(too young ...
- HDU——1013Digital Roots(九余数定理)
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- HDU 1163 Eddy's digital Roots(模)
HDU 1163 题意简单,求n^n的(1)各数位的和,一旦和大于9,和再重复步骤(1),直到和小于10. //方法一:就是求模9的余数嘛! (228) leizh007 2012-03-26 21: ...
- Eddy's digital Roots(九余数定理)
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- HDU1163【九余数定理】【水题】
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
随机推荐
- canal 监控数据库表 快速使用
https://github.com/alibaba/canal 快速开始 https://github.com/alibaba/canal/wiki/QuickStart 注意 1. vim con ...
- as3 TweenMax TweenLite方法
as3 TweenMax TweenLite方法补充(暂停.重新播放.倒序播放).现在来好好的学习一下: TweenLite.to(mc, 1.5, {x:100}); 里面的mc指所作用的对象, ...
- eclipse菜单栏工具
1. new Class 和 new Package 通过右键->new -> 找到java->class 方式太慢. 在window->perspective -> c ...
- CAAnimation临时取消动画,永久取消动画
//临时取消动画 [CATransaction begin]; [CATransaction setDisableActions:YES]; mMyLayer.strokeEnd = 0; [CATr ...
- 【OpenPose-Windows】运行OpenposeDemo.exe 如何保存图像运行结果及关节点信息
跑过很多次openposeDemo了,不管是video.Webcam还是Images,都是运行结果一闪而过,然而我们所要的肯定不是只看一下运行结果就完事的,很多情况下,我们都希望能够把运行结果的图像. ...
- 移去OleContainer的黑边框
//禁止双击打开word编辑 olecontainer1.AutoActivate := aaManual; //禁止右键菜单 olecontainer1.AutoVerbMenu := False; ...
- delphi TEdit透明
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- winform程序开机启动时的运行目录
并不是程序的当前路径,而是系统的某个目录 如环境是win10 64位,路径是 c:\winfows\SysWOW64\ConfigInfor.json
- wireshark使用相关问题
问题1: 打开wireshark,没有出现过滤器 解决1: 使用管理员方式登录 过滤: http and ip.src == 192.168.0.10 and ip.dst == 192.168.0. ...
- linux、centos下查看系统版本、bios版本,内存信息等
1.查看系统版本 [root@localhost ~]# more /etc/issueCentOS release 6.2 (Final)Kernel \r on an \m 2.查看CPU信息 : ...