A 牛牛扔牌 菜鸡解法 暴力算 C++
牛牛扔牌
https://ac.nowcoder.com/acm/contest/6219/A
菜鸡解法 暴力算
class Solution { public: /** * * @param x string字符串 字符串从前到后分别是从上到下排列的n张扑克牌 * @return string字符串 */ string Orderofpoker(string x) { int xnc = x.length() / 2; string cz = ""; for (int i = 0;i<xnc; i++) { int n = 1; for (int j = 2; j < x.length()/2; j++) { if ((x.length() / 2) % j == 0) { n = 0; } } if (n==0) { cz+=x[x.length() - 2]; cz += x[x.length() - 1]; x = x.substr(0, x.length() - 2); } else { cz += x[0]; cz += x[1]; x = x.substr(2); } } return cz; } };