C++还原加密数字
void 还原加密数字() { int a[30]{0}, aa[30]{0}, n = 0, j = 0, jj = 0, js = 0; bool k = true; cout << "输入位数和数据:"; cin >> n; while (j < n)cin >> aa[j], a[j] = j++ + 1; --j; while (j) {//缘由https://bbs.bccn.net/viewthread.php?tid=499258&page=1&extra=#pid2719048 if (a[jj++] <= n) if (++js >= aa[j]) if (a[jj -= (aa[j] && k ? 0 : 1)] <= n) cout << a[jj] << ends, a[jj] += n, jj = js = 0, --j, k = true; else k = false; } j = 0; while (j < n)if (a[j] <= n)cout << a[j++] << endl; else ++j; }
void 还原加密数字() { int a[30]{0}, aa[30]{0}, n = 0, j = 0, jj = 0, js = 0, CI = 0; bool k = true; cout << "输入位数和数据:"; cin >> n; while (j < n)cin >> aa[j], a[j] = j++ + 1; --j; while (j) {//缘由https://bbs.bccn.net/viewthread.php?tid=499258&page=1&extra=#pid2719048 if (a[jj++] <= n) if (++js >= aa[j]) if (a[jj -= (aa[j] && k ? 0 : 1)] <= n) aa[j] = a[jj], a[jj] += n, CI += jj, jj = js = 0, --j, k = true;//, cout << a[jj] << ends else k = false; else continue; else continue; } j = 0; while (j < n)if (a[j] <= n)aa[0] = a[j++]; else ++j;//, cout << aa[j++] << ends j = 0; while (j < n) cout << aa[j++] << ends; cout << CI << endl; //while (j) cout << aa[n - j--] << ends; }
原创文章,作者:xianfajushi的博客,如若转载,请注明出处:https://www.zengqueling.com/c%e8%bf%98%e5%8e%9f%e5%8a%a0%e5%af%86%e6%95%b0%e5%ad%97/