HOJ 2275 Number sequence】的更多相关文章

题意:问你有多少个序列满足Ai < Aj > Ak and i < j < k. 思路:对每个数求它之前和之后分别有多少个个数比它小,两边相乘.最后求和.具体实现先用树状数组正序求,再反过来再用一遍树状数组. 代码:特别要注意的是题目中Ai的范围是从0开始,但是树状数组不能从0开始,所以统一加一处理.但是可惜的是题目并没有出现0这样的数据,让一些并不正确的代码过了. #include<stdio.h> #include<string.h> int lowbi…
http://acm.hit.edu.cn/hoj/problem/view?id=2275 Source : SCU Programming Contest 2006 Final   Time limit : 1 sec   Memory limit : 64 M Submitted : 1864, Accepted : 498 Given a number sequence which has N element(s), please calculate the number of diff…
点击打开HIT 2275 思路: 树状数组 分析: 1 题目要求的是总共的搭配方式,满足Ai < Aj > Ak.并且i j k不同 2 我们开两个树状数组,第一个在输入的时候就去更新.然后我们在去枚举Aj 同时维护第二个树状数组,对于AI来说就是在第二个树状数组里面求和 然后在通过第一个树状数组就可以求出Ak的个数,把结果相乘即可 代码: #include<cstdio> #include<cstring> #include<iostream> #incl…
Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 154923    Accepted Submission(s): 37854 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…
找规律,先找属于第几个循环,再找属于第几个数的第几位...... Number Sequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 31552 Accepted: 8963 Description A single positive integer i is given. Write a program to find the digit located in the position i in the sequ…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8600    Accepted Submission(s): 3953 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[…
Number Sequence   A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n).   Input The input consists of multiple test cases. Each test case co…
AX2012的number sequence framework中引入了两个Scope和segment两个概念,它们的具体作用从下面序列的例子说起. 法国/中国的法律要求财务凭证的Journal number包含公司代码和财务期间,比如这样的号码J-20-Jan11-000340,J表上Journal,20代表的是公司代码,Jan11为财务期间,000340才是系统生成的流水号. 在创建Numer sequence的界面上可以选择需要的Scope: Company and fiscal cale…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11606    Accepted Submission(s): 5294 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b…
Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 89984    Accepted Submission(s): 21437 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…