某未出土选手出土训练还没做就来打比赛了。
还好我设置了提醒,不然就忘记了…
只做了T1和T2
T1
Description
给一个数,表示成两个数相加的形式,,其中,的各位不能包含
Solution
每位独立的来做就好了…
一共三个点,第一个点,第二个点,最后一个点才
暴力可以过第一个点,随机化可以过第二个点,然后我最后写的这个应该可以过第三个点。
一开始以为不能输出0的,怕被111这种卡掉,然后发现好像可以,然后被100卡掉了…最后修改了一下
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #include <bits/stdc++.h> using namespace std;
const int N = 105;
char ch[N]; int ans1[N], ans2[N];
void out(int l, int ans[]) { int s=0; for(; s<l; s++) if(ans[s]) break; if(s==l) putchar('0'); for(; s<l; s++) putchar('0'+ans[s]); }
int main() { srand(time(0)); int t; scanf("%d",&t); for(int c=1;c<=t;c++) { scanf("%s", ch); int l=strlen(ch); for(int i=0; i<l; i++) { int x=ch[i]-'0'; if(x==0) { ans1[i]=ans2[i]=0;continue; } for(int u=1; u<=x; u++) if(u!=4 && x-u!=4) { if(rand()&1) { ans1[i]=u, ans2[i]=x-u; } else { ans1[i]=x-u, ans2[i]=u; } break; } } printf("Case #%d: ",c); out(l, ans1), putchar(' '), out(l, ans2), putchar('\n'); } return 0; }
|
T2
Description
一个的网格,每次只能向右或向下,给出一条路径,让你不发生路径覆盖的从左上走到右下。
Solution
…
其实输出对称的路径就能过…
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #include <bits/stdc++.h> using namespace std;
const int N = 100005;
char ch[N];
int main() { int t, n, l; scanf("%d", &t); for(int c=1; c<=t; c++) { scanf("%d", &n); scanf("%s", ch); l=strlen(ch); for(int i=l-1; ~i; i--) { if(ch[i]=='S') ch[i]='E'; else ch[i]='S'; } printf("Case #%d: %s\n", c, ch); } return 0; }
|
后面两道题连开都没开..
然后时间就到了…
昨天开始的,现在已经结束了…差点没赶上..