Exact Phase Transitions and Approximate Algorithm of #CSP