Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:糊涂了……哪位帮帮忙……

Posted by frkstyc at 2005-05-09 22:28:12 on Problem 2159
In Reply To:糊涂了……哪位帮帮忙…… Posted by:wxn0000 at 2005-05-09 22:25:16
置换表+重排的加密不是那么容易破解的吧?肯定要做频率对应的,而且要在统计完后才做的

> 注释里的代码就可以AC
> 这样就不行了……咋回事啊?
> 没注释掉的是把msg2先按第一种加密方法处理一下
> 
> #include <iostream>
> #include <string>
> using namespace std;
> 
> void main()
> {
> 	string a, b;
> 	cin >> a >> b;
> 	int m[26] = {0,}, n[26] = {0,};
> 	int i;
> 
> 
> 	for( i = 0; i < a.size(); i ++ )//以下有问题
> 		m[a[i] - 'A'] ++;
> 	for( i = 0; i < b.size(); i ++ )
> 	{
> 		if( b[i] != 'Z' )
> 			n[b[i] - 'A' + 1] ++;
> 		else n[0] ++;
> 	}
> 
> 	for( i = 0; i < 26; i ++ )
> 	{
> 		if( m[i] != n[i] )
> 			break;
> 	}
> 	if( i == 26 )
> 		cout << "YES" << endl;
> 	else cout << "NO" << endl;
> 
> /*	for( i = 0; i < a.size(); i ++ )//以下正确
> 		m[a[i] - 'A'] ++;
> 	for( i = 0; i < b.size(); i ++ )
> 		n[b[i] - 'A'] ++;
> 	for( i = 0; i < 26; i ++ )
> 	{
> 		for( int j = 0; j < 26; j ++ )
> 		{
> 			if( m[i] == n[j] )
> 				break;
> 		}
> 		n[j] = 0;
> 		if( j == 26 )
> 		{
> 			cout << "NO" << endl;
> 			return;
> 		}
> 	}
> 	if( i == 26 )
> 		cout << "YES" << endl;*/
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator