武大OJ 613. Count in Sama’s triangle
Description
Today, the math teacher taught Alice Hui Yang’s triangle. However, the teacher came up with a new one, called Sama’s triangle (some of you may be familiar with this name).
Input
The input consists of several test cases.
The first line consists of one integer T (T <= 500), meaning the number of test cases.
For each test cases, there is one integer M (M<= 1e9), which is asked from the teacher.
Here, 1eX means 1000…0000 (x 0s).
Output
For each test case, output the times number M shows up in all positions of all triangles.
Sample Input
1
3
Sample Output
4
每个位置的数可以用一个二元一次函数表示
武大OJ 613. Count in Sama’s triangle的更多相关文章
- LeetCode OJ 222. Count Complete Tree Nodes
Total Accepted: 32628 Total Submissions: 129569 Difficulty: Medium Given a complete binary tree, cou ...
- LeetCode OJ:Count Primes(质数计数)
Count the number of prime numbers less than a non-negative number, n. 计算小于n的质数的个数,当然就要用到大名鼎鼎的筛法了,代码如 ...
- LeetCode OJ:Count Complete Tree Nodes(完全二叉树的节点数目)
Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W ...
- LeetCode OJ:Count and Say(数数)
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...
- 武大OJ 612. Catch the sheep
Description Old Sama is a great and powerful magician in the word. One day, a little girl, Anny, tou ...
- 武大OJ 574. K-th smallest
Description Give you a number S of length n,you can choose a position and remove the number on it.Af ...
- 武大OJ 622. Symmetrical
Description Cyy likes something symmetrical, and Han Move likes something circular. Han Mov ...
- 武大OJ 706.Farm
Farmer John has a farm. Betsy, a famous cow, loves running in farmer John's land. The noise she made ...
- All LeetCode Questions List 题目汇总
All LeetCode Questions List(Part of Answers, still updating) 题目汇总及部分答案(持续更新中) Leetcode problems clas ...
随机推荐
- hdu61272017杭电多校第七场1008Hard challenge
Hard challenge Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) ...
- 【转】Spark:Master High Availability(HA)高可用配置的2种实现
原博文出自于: 感谢! Spark Standalone集群是Master-Slaves架构的集群模式,和大部分的Master-Slaves结构集群一样,存在着Master单点故障的问题.如何解决这个 ...
- kali中的APT软件包处理工具(apt-get)、Debian软件包管理器(dpkg)、源代码压缩和Nessus安装实用指南
写在前面的话 能看懂此博客的朋友,深信你有一定的Kali基础了. 使用APT软件包处理工具(apt-get).Debian软件包管理器(dpkg)来维护.升级和安装自定义及第三方应用程序 APT软件包 ...
- iPhone4到iPhone6的设计、制造工艺历程浅析
这里就阐述一下我对这几个手机在设计和制造工艺上的一些看法. 这 5 个型号概括起来就三个外观: iPhone4 的三明治夹心设计. iPhone5 的三段式铝合金一体成型. iPhone6 的全金属一 ...
- VS中设置xml智能提示
1.第一步:将xsd文件复制到VS的安装目录下 默认安装目录为:C:\Program Files (x86)\Microsoft Visual Studio 12.0\Xml\Schemas 2.第二 ...
- 计算给定数组 arr 中所有元素的总和的几种方法
1.forEach遍历: function sum(arr) { var result = 0; arr.forEach(function(item,index) { ...
- Python代码搜索并下载酷狗音乐
运行环境: Python3.5+Pycharm 实例代码: import requests,re keyword = input("请输入想要听的歌曲:") url = " ...
- python模块中的__all__属性
转自:http://blog.csdn.net/sxingming/article/details/52903377 python模块中的__all__属性,可用于模块导入时限制,如:from mod ...
- Maven对不同的测试环境用不同的参数进行打包
通过mvn package -P ${env} 加载不同配置文件 1.pom.xml中的配置 filter-dev.properties jdbc.properties
- java读取03、07版EXCEL
03版excel,需要用到jxl.jar这个jar包 package test.poi; import java.io.File; import java.io.IOException; import ...