# IPSC2016_因吹思挺

## Problem A

• easy: 串长度为42
• hard: 串长度为39

42的直接输出在加两个就好了

39的O(N2)$O(N^2)$找一下对应的(代码在最下面)

## Problem C

### 题解

• easy BFS找到sort到original的shortest path数量
• hard 置换的统计数…递推上去

• 诗兄: 找规律

more than enough to guess the pattern, or to make a lookup in the Online Encyclopedia of IntegerSequences (OEIS). It turns out that for l ≥ 2 we have C(l) = ll2${l}^{l−2}$. This can be computed quickly usingmodular exponentiation.Cayley’s formula

• 发现一个神奇的找规律网站

• 把HTML页面下在本地
• 发现并不是随机数
• 做字符串命令解析

## Problem G

• easy 保留所有数字输出
• hard 去除前导0(下面有代码XD)
//作为队内水题主力的我233
//A_Hard
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int maxn = 10 + 5;
string str[maxn];
int suc = false,fr,bk;

int main()
{
freopen("a2.in", "r", stdin);
freopen("a2.out", "w", stdout);
int T;
scanf("%d",&T);
while (T--) {
for (int a = 0; a < 10; a++) {
cin >> str[a];
}
suc = false;
int pos = -1,del = 0;
while (suc == false) {
pos++;
for (int k = 0; k < 10; k++) {
if (k != pos) {
if (str[k][3] == str[pos][0]) {
bk = pos;
fr = k;
suc = true;
del = 1;
break;
}else if (str[k][2] == str[pos][0]
&&str[k][3] == str[pos][1])
{
bk = pos;
fr = k;
suc = true;
del = 2;
break;
}else if (str[k][1] == str[pos][0]
&&str[k][2] == str[pos][1]
&&str[k][3] == str[pos][2])
{
bk = pos;
fr = k;
suc = true;
del = 3;
break;
}
else if (str[k]== str[pos])
{
bk = pos;
fr = k;
suc = true;
del = 4;
break;
}
}//暴力比较.
}
}
cout << str[fr] ;
for (int i = del; i < 4; i++) {
cout << str[bk][i];
}
for (int i = 0; i < 10; i++) {
if (i != fr && i != bk) {
cout << str[i];
}
}
del--;
for (int i = 0; i < del; i++) {
cout << "H" ;
}
cout << endl;
}
return 0;
}

//g hard
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
string a,ans;
int main()
{
freopen("g2.in", "r", stdin);
freopen("g2.out", "w", stdout);
int T;
scanf("%d",&T);
while (T--) {
cin >> a;
ans = "";
for (int i = 0; i < a.size(); i++) {
if (a[i] >= '0' && a[i] <= '9') {
ans += a[i];
}
}
while (ans.size() > 1 && ans[0] == '0') {
ans.erase(ans.begin());
}
cout << ans << endl;
}
return 0;
}

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120