模拟赛链接A 第一个水题要知道units digit的意思 (个位数)有一点点小繁琐。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #defin...
分类:
其他好文 时间:
2014-07-09 00:55:55
阅读次数:
317
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 ...
分类:
其他好文 时间:
2014-07-08 14:12:32
阅读次数:
226
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
其他好文 时间:
2014-07-06 16:11:35
阅读次数:
170
说实话,这道题给人的感觉不难,虽然第一次提交的时候超时了一次,然后看了一下数据量,稍作修改,提交,A了,但现在还是不知道为什么A了,上网搜了各种题解,感觉和他们的还是不一样。解题思路:因为它要求的就是最后结果的个位数,又因为它是n个n相乘的结果,我只要去n的个位数就够了,就是n对10取余,然后(.....
分类:
Web程序 时间:
2014-07-06 14:01:48
阅读次数:
135
DescriptionAn accutron shows time with four digits, from 0000 to 2359. Every digit is represented by 3*3 characters, including '|'s, '_'s and blanks. ...
分类:
其他好文 时间:
2014-07-06 13:19:09
阅读次数:
300
题目链接:uva 10162 - Last Digit
题目大意:给定n,求s的个位的数值是多少。
解题思路:对于ii,重复周期为20,这样就有
1 4 7 6 5 6 3 6 9 01 6 3 6 5 6 7 4 9 0
但是这个周期的值是不为0的,总的话是100为一个大周期。
#include
#include
#include
using namespace s...
分类:
其他好文 时间:
2014-07-06 00:09:23
阅读次数:
239
找规律!求N!最后非0位的值。比方2是120的最后一个不是0的值。输入N比較大,要大数保存。注意到最后0的个数是与5的因数的个数相等。设f(n)为n!的最后非0位。那么f(n)=((n%5)!* f(n/5) *2^(n/5))%10因数2的个数始终大于5,从1開始每连续5个划分为1组,当中5的倍数...
分类:
其他好文 时间:
2014-07-05 17:28:05
阅读次数:
174
UVA 10162 - Last Digit
题目链接
题意:求S=(11+22+...NN)%10
思路:打出0-9的每个周期,发现周期为1或2或4、所以S是以20一个周期,打出表后发现20为4,所以对应的40为8,60为2,80为6,100为0,100为1个周期,且为0,所以先把数字mod上100,然后在mod 20求出对应位置。
代码:
#include
#i...
分类:
其他好文 时间:
2014-07-04 07:25:45
阅读次数:
200
grep命令详解及相关事例一.匹配字符.匹配任意单个字符[]匹配指定范围内的任意字符[^]匹配飞指定范围内的任意字符[:alpha:]字母字符[:lower:]小写字母字符[:upper:]大写字母字符[:digit:]数字[:alnum:]字母数字字符[:space:]空白字符(禁止打印),如回车符、换行符、竖直制表符..
分类:
其他好文 时间:
2014-07-04 06:07:39
阅读次数:
207
题目
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it a...
分类:
其他好文 时间:
2014-07-01 09:11:07
阅读次数:
206