題目連結:http://www.topcoder.com/stat?c=problem_statement&pm=10333//遞迴的整體思想 宏觀看微觀#include <string>#include <vector>#include <cmath>using namespace std;struct PlaneFractal{char check(int s, int N, int K, int x, int y){if(s==0)return
This weekend, I listen to the speech given by Tangjun, who is called the emperor of employees. And his speech has given me great inspiration, and now I want to share with all of us. First when we are working, you may come across many things that you
簡單的一個二維樹狀數組的應用,沒有變形題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1892//二維樹狀數組//#include<stdio.h>const int size = 1002;int C[size][size];int D[size][size];int lowbit(int n){ return n&(-n);}void Modify(int x, int y, int delta){
Recently I came across TCO , and I love it . I decide to devote my spare time to play here .Here I'd like to give you two ways to solve this problem . It is very easy! Problem: Given you a integer number , the beauty of this number is the number
題目連結:http://www.topcoder.com/stat?c=problem_statement&pm=10395&rd=13747這個題目比較簡單,主要是看迴圈循序不同對演算法效率的影響one:#include<string>#include<vector>using namespace std;struct SquareOfDigits{ int min(int a,int b) { return a<b?a:b; } int
My idea: At first I solve this problem with the greedy approach (keeping the number maximal for every iteration) and all the test cases given is right . Later on I find some cases from the discussion that my code gives the wrong answer . For
Here is my code when I am learning the function of count in map . #include <iostream>#include <map>using namespace std;typedef pair<int,int> pa;typedef map<int,int> ma;typedef pair<pa,int> paa;typedef map<pa,int>