Problem 48
Problem 48
The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
使用math.pow进行pow(1000, 1000)时会弹出OverflowError: math range error错误,所以自己造了一个power函数。
def power(x, y):
tot = 1
for i in range(y):
tot *= x
return tot tot = 0
for i in range(1, 1001): # except zero
p = power(i, i)
tot += power(i, i)
print(str(tot)[-10:])
Problem 48的更多相关文章
- uoj 48 核聚变反应强度 次小公因数
[UR #3]核聚变反应强度 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://uoj.ac/problem/48 Description 著名核 ...
- EularProject 48: 利用数组求和
Problem 48 The series, 11+22+33+...+1010=10405071317. Find the last ten digits of the series, 11+22+ ...
- UVa 112 - Tree Summing(树的各路径求和,递归)
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&pa ...
- 基础数据结构之(Binary Trees)
从头开始刷ACM,真的发现过去的很多漏洞,特别越是基础的数据结构,越应该学习得精,无论是ACM竞赛,研究生考试,还是工程上,对这些基础数据结构的应用都非常多,深刻理解非常必要.不得不说最近感触还是比较 ...
- Shallwe学长的模拟赛
NOIP Simulated Test 这个名字一听就很高端. T1:sGCD:http://uoj.ac/problem/48 题意概述:给定一个长度为$n$的序列,求$sgcd(a_1,a_i)$ ...
- 【Codeforces Beta Round #45 D】Permutations
[题目链接]:http://codeforces.com/problemset/problem/48/D [题意] 给你n个数字; 然后让你确定,这n个数字是否能由若干个(1..x)的排列连在一起打乱 ...
- Levmar:Levenberg-Marquardt非线性最小二乘算法
Levmar:Levenberg-Marquardt非线性最小二乘算法 eryar@163.com Abstract. Levmar is GPL native ANSI C implementati ...
- bestcoder 48# wyh2000 and a string problem (水题)
wyh2000 and a string problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K ...
- 48. Rotate Image (matrix retation, transpose) Amazon problem
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...
随机推荐
- 的Linq未提交之前插入/修改时重新查询不准确问题
来园子已经两年了,每次都是看,这次咱也写一次. 说一下今天遇到的Linq问题: 每一次插入流水表时,都需要查找表中最大的流水号+1,并且将该流水号返回,但是在同一个SubmitChange之内插入多条 ...
- elasticsearch 分页查询实现方案——Top K+归并排序
elasticsearch 分页查询实现方案 1. from+size 实现分页 from表示从第几行开始,size表示查询多少条文档.from默认为0,size默认为10,注意:size的大小不能超 ...
- 【BZOJ2693】jzptab & 【BZOJ2154】Crash的数字表格
题目 弱化版题目的传送门([BZOJ2154]Crash的数字表格) 加强版题目的传送门([BZOJ2693]jzptab) 思路&解法 题目是要求: \(\sum\limits_{i = 1 ...
- jdbc 接口学习笔记
一.JDBC概念 JDBC(Java Data Base Connectivity,java数据库连接)是一种用于执行SQL语句的Java API,可以为多种关系型数据库提供统一访问,它由一组用Jav ...
- 分别使用Hadoop和Spark实现TopN(1)——唯一键
0.简介 TopN算法是一个经典的算法,由于每个map都只是实现了本地的TopN算法,而假设map有M个,在归约的阶段只有M x N个,这个结果是可以接受的并不会造成性能瓶颈. 这个TopN算法在ma ...
- A - Team
Problem description One day three best friends Petya, Vasya and Tonya decided to form a team and tak ...
- mygenerator().next() AttributeError: 'generator' object has no attribute 'next'
def mygenerator(): print ("start ...") yield 5 mygenerator() print ("mygenerator():&q ...
- .Net Core(二) 下
接上面 http://www.cnblogs.com/xcodevs/p/5584218.html 在解决方案浏览器中,右击 Controllers 目录.选择添加>新建项.选择Web API控 ...
- Spring Cloud (2) 服务消费者-基础
LoadBalancerClient 使用Spring Cloud提供的负载均衡器客户端来实现服务的消费. 首先创建一个服务消费者工程,命名为com.david.consumer,并在pom.xml中 ...
- Spring Boot (16) logback和access日志
Spring Boot 内部采用的是Commons Logging进行日志记录,但是在底层为Java Util Logging.Log4J2.Logback等日志框架提供了默认配置. logback ...