因吹思挺
2016-06-19 09:58
363 查看
IPSC2016_因吹思挺
趣味编程大赛XD官方题解
考前拉倒诗兄 三金两条大腿一起来玩2333
然而因为我太困-.-提前睡了 早上起来发现rk300嘻嘻
Problem A
给出十个长度为4的字符串,求一个包含这十个字符串的一个串easy: 串长度为42
hard: 串长度为39
42的直接输出在加两个就好了
39的O(N2)找一下对应的(代码在最下面)
Problem C
给出一段序列,求最小交换次数 的可能种类题解
easyBFS找到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) = ll−2. This can be computed quickly usingmodular exponentiation.Cayley’s formula
发现一个神奇的找规律网站
Problem D (JS解析题)
给出一个页面,,要求我们玩命令指示点击游戏九百多关,,通关console交上去
把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; }