body { font-family: Monospaced; font-size: 12pt } pre { font-family: Monospaced; font-size: 12pt } Problem Statement You have an array with N elements. Initially, each element is 0. You can perform the following operations: Increment operation:…
周赛时遇到的一道比较有意思的题目: Problem Statement There are N rooms in Maki's new house. The rooms are numbered from 0 to N-1. Some pairs of rooms are connected by bidirectional passages. The passages have the topology of a tree. That is, there are exactly N-…
第一次做TC,不太习惯,各种调试,只做了一题...... Problem Statement Fox Ciel is going to play Gomoku with her friend Fox Jiro. Ciel plays better, so before they start she allowed Jiro to put some of his pieces on the board. You are given a vector <string> board tha…
最近一场TC,做得是在是烂,不过最后challenge阶段用一个随机数据cha了一个明显错误的代码,最后免于暴跌rating,还涨了一点.TC题目质量还是很高的,非常锻炼思维,拓展做题的视野,老老实实补题吧. div2 250pts 题意:判断s去掉一个字符后能否和t一样. 代码: class DecipherabilityEasy { public: string check(string s, string t) { int n = s.size(); int m = t.size(); !…
http://community.topcoder.com/stat?c=problem_statement&pm=12995 简单题 class PackingBallsDiv2 { public: int minPacks(int R, int G, int B) { int sum = 0; sum += (R / 3); sum += (G / 3); sum += (B / 3); R %= 3; G %= 3; B %= 3; while ((R > 0 || G > 0…
http://community.topcoder.com/stat?c=problem_statement&pm=13091 解方程,对中国孩子太简单了. #include <vector> #include <iostream> using namespace std; class LongLongTripDiv2 { public: string isAble(long long D, int T, int B) { long long diff = (D - T);…
http://community.topcoder.com/stat?c=problem_statement&pm=13147 此题关键在于发现ABAB的组合最多有26*26种,可以穷举,然后用判断子序列~ #include <vector> #include <iostream> using namespace std; class LongWordsDiv2 { public: string find(string word) { for (int i = 0; i &…
https://www.topcoder.com/stat?c=problem_statement&pm=13146&rd=15852 // Need carefully calc the shift and the final index #include <vector> using namespace std; class ChooseTheBestOne { public: int countNumber(int N) { vector<int> vec(N…
http://community.topcoder.com/stat?c=problem_statement&pm=13243 就是能否通过把字符串中的'X'替换成"()", "[]", and "{}"来变成合法的括号字符串, "([]X()[()]XX}[])X{{}}]"Returns: "possible"You can replace 'X's respectively with '{',…
Topcoder上的一道题目,题目描述如下: Problem Statement Byteland is a city with many skyscrapers, so it's a perfect venue for BASE jumping. Danilo is an enthusiastic BASE jumper. He plans to come to Byteland and to jump off some of its buildings. Danilo wants…