武大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 ...
随机推荐
- MongoDB一些常用指令与他的JavaScript的对应表
- 平方分割poj2104K-th Number
K-th Number Time Limit: 20000MS Memory Limit: 65536K Total Submissions: 59798 Accepted: 20879 Ca ...
- java大数轻松过
import java.util.Scanner; import java.math.BigInteger; public class Main { public static void main(S ...
- Hadoop Hive概念学习系列之hive的数据压缩(七)
Hive文件存储格式包括以下几类: 1.TEXTFILE 2.SEQUENCEFILE 3.RCFILE 4.ORCFILE 其中TEXTFILE为默认格式,建表时不指定默认为这个格式,导入数据时会直 ...
- request获取请求参数
/** * 方式1 */ Enumeration<?> enu=request.getParameterNames(); while(enu.hasMoreElements()){ Str ...
- Integer / BigInteger / BigDecimal 方法
import java.math.BigDecimal; import java.math.*; public class Main{ public static void main(String[] ...
- STL容器迭代过程中删除元素技巧(转)
1.连续内存序列容器(vector,string,deque) 序列容器的erase方法返回值是指向紧接在被删除元素之后的元素的有效迭代器,可以根据这个返回值来安全删除元素. vector<in ...
- input checkbox 选择内容输出多少个
<input type="checkbox" name="qId" onclick="doit();"/><input t ...
- PSP辅助软件开发计划
PSP辅助软件开发计划 作者: 日期:2013年11月14号 1开发目的 鉴于软件开发过程中,程序员往往无法在规定时间内完成任务,而且无法给出拖延的时间从而造成项目进度计划不准确.开发此软件帮助程序员 ...
- x86汇编之十(使用字符串)
x86汇编之十(使用字符串) 转自网络,出处不详 一.传送字符串 Intel提供了完整的字符串传送指令,就像是MOV指令一样. 1.MOVS指令 1)movs指令格式 把字符串从一个位内存位置传送到另 ...