Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:糊涂了……哪位帮帮忙……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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator