思路:统计一串字符有多少个'A',并分别统计出每个'A'前后有多少'Q'.然后让每个'A'前后的'Q'相乘并相加就能得出结果了. 注意:数据的类型,卡了int,要用long long. 还有就是在pc^2上面用gets()读入字符串会WA? AC代码: #include<bits/stdc++.h> #define ll long long #define ms(a) memset(a,0,sizeof(a)) using namespace std; const int maxn=1e6+1…
1112 - Curious Robin Hood PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 64 MB Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the money together he does another trick.…
You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. We will ask you to perfrom some instructions of the following form: CHANGE i ti : change the cost of the i-th edge to tior QUERY a b : ask fo…
发现自己越来越傻逼了.一道傻逼题搞了一晚上一直超时,凭啥子就我不能过??? 然后发现cin没关stdio同步... Description Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long board with length…
A. Far Relative's Birthday Cake 题目连接: http://www.codeforces.com/contest/629/problem/A Description Door's family is going celebrate Famil Doors's birthday party. They love Famil Door so they are planning to make his birthday cake weird! The cake is a…