Problem 2275 Game Accept: 62 Submit: 165Time Limit: 1000 mSec Memory Limit : 262144 KB Problem Description Alice and Bob is playing a game. Each of them has a number. Alice’s number is A, and Bob’s number is B. Each turn, one player can do one…
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…
题意:问你有多少个序列满足Ai < Aj > Ak and i < j < k. 思路:对每个数求它之前和之后分别有多少个个数比它小,两边相乘.最后求和.具体实现先用树状数组正序求,再反过来再用一遍树状数组. 代码:特别要注意的是题目中Ai的范围是从0开始,但是树状数组不能从0开始,所以统一加一处理.但是可惜的是题目并没有出现0这样的数据,让一些并不正确的代码过了. #include<stdio.h> #include<string.h> int lowbi…