A
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
int A[50];
int main()
{
int n; string s;
cin>>n;
cin>>s;
memset(A,0,sizeof(A));
for(int i=0;i<n;i++)
{
int c;
if(s[i] >= 'A' && s[i] <= 'Z')
c = s[i] - 'A';
else if(s[i] >= 'a' && s[i] <='z') c = s[i] - 'a';
A[c] = 1;
}
int flag = true;
for(int i=0;i<26;i++) if(A[i] == 0)
{
flag = false;
break;
}
if(flag) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
B
/* ***********************************************
Author :mogu
Created Time :2015/3/9 10:17:30
File Name :
************************************************ */
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
int main()
{
int N, M;
cin>>N>>M;
int r = 0;
while(M > N)
{
if(M & 1) M++,r++;
M /= 2;
r++;
}
cout<<r + N - M<<endl;
return 0;
}
C题
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <cmath>
#define LL long long
using namespace std;
const int mod = 1e9 + 7;
const int MAXN = 100000 + 10;
int C[MAXN];
LL pow_mod(LL a, LL b)
{
LL res = 1;
while(b)
{
if(b & 1) res = res * a % mod;
a = a * a % mod;
b>>=1;
}
return res;
}
int main()
{
int n; string s;
while(cin>>n)
{
cin>>s;
memset(C, 0, sizeof(C));
int len = s.length();
for(int i=0;i<len;i++)
{
if(s[i] == 'A') C[0]++;
else if(s[i] == 'G') C[1]++;
else if(s[i] == 'C') C[2]++;
else C[3]++;
}
sort(C,C+4,greater<int>());
int x = 1;
for(int i=1;i<=3;i++)
{
if(C[i] == C[0]) x++;
else break;
}
int ans = pow_mod(x, n);
cout<<ans<<endl;
}
return 0;
}