C++还原加密数字

默认分类 | 2020-02-17 13:43:12 | 阅读 551 次 | 评论(0)


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;
}
无标题.png (上传于2020-02-17 13:43:12)
无标题.png

无标题.png (上传于2020-02-17 17:36:57)
无标题.png

无标题.png (上传于2020-02-17 17:38:16)
无标题.png

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;
}

无标题.png (上传于2020-02-19 03:39:29)
无标题.png

文章评论,共0条
游客请输入验证码