# 山东省第二届ACM大学生程序设计竞赛 Crack Mathmen

AC代码：

```#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#define mod 997

using namespace std;

int t, n;
int a[1000001], cnt;
char str[1000010];

int solve(int a, int n)
{
if(n == 0)
return 1;
int x = solve(a, n / 2);
long long ans = (long long)x * x % mod;
if(n % 2 == 1)
ans = ans * a % mod;
return (int)ans;
}

int main()
{
map<int, char>m;
map<int, int>flag;
scanf("%d", &t);
while(t--)
{
m.clear();
flag.clear();
cnt = 0;
scanf("%d", &n);
scanf("%s", str);
int len = strlen(str);
if(len % 3 != 0)
{
printf("No Solution\n");
continue;
}
for(int i = 0; i < len ; i+=3)
{
int tmp = 0;
tmp = tmp * 10 + str[i] - ‘0‘;
tmp = tmp * 10 + str[i + 1] - ‘0‘;
tmp = tmp * 10 + str[i + 2] - ‘0‘;
a[cnt++] = tmp;
}
for(int i = 65; i <= 90; i++)
{
int tmp = solve(i, n);
m[tmp] = (char)i;
flag[tmp]++;
}
for(int i = 48; i <= 57; i++)
{
int tmp = solve(i, n);
m[tmp] = (char)i;
flag[tmp]++;
}
for(int i = 97; i <= 122; i++)
{
int tmp = solve(i, n);
m[tmp] = (char)i;
flag[tmp]++;
}
bool mark = 1;
for(int i = 0; i < cnt; i++)
{
if(flag[a[i]] != 1)
{
mark = 0;
break;
}
else
{
str[i] = m[a[i]];
}
}
str[cnt] = ‘\0‘;
if(!mark) printf("No Solution\n");
else printf("%s\n", str);
}
return 0;
}

/**************************************
Problem id    : SDUT OJ E
User name    : xam140325乔璐
Result        : Accepted
Take Memory    : 2568K
Take Time    : 40MS
Submit Time    : 2016-05-02 16:41:19
**************************************/```

## [2011山东省第二届ACM大学生程序设计竞赛]——Identifiers

Identifiers Time Limit: 1000MS Memory limit: 65536K 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2163 题目描写叙述 Identifier is an important concept in the C programming language. Identifiers provide names for several language

## 山东省第一届ACM大学生程序设计竞赛(原题) 回顾 4.18

Phone Number 题目链接:http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2151&cid=1172 题意很简单:给出N行电话号码,寻找有没有一串是另一串的前缀,有的话输出No,当然两个一样的也是No 题解:没有前缀0,直接用二维数组存,大循环就行了,用strcmp比较相等.不会超时. Hello World!     题目链接:http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=215

## [简单思维题]Sequence(山东省第九届ACM大学生程序设计竞赛E题)

Problem Description We define an element a_iai? in a sequence "good", if and only if there exists a j(1\le j < i)j(1≤j<i) such that a_j < a_iaj?<ai?.Given a permutation pp of integers from 11 to nn. Remove an element from the permuta

## [2012山东省第三届ACM大学生程序设计竞赛]——Fruit Ninja II

Fruit Ninja II 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2416 Time Limit: 5000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Have you ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja