一、比赛基本情况
比赛日期:8月27日 比赛时长:1:30 比赛得分:150分 比赛排名:1
二、比赛整体回顾
简要记录本场比赛的做题顺序、时间安排、比赛状态以及整体感受。 比之前的难上好多。
三、题目复盘
T1:地图探险
本题得分:50分 开始时间:2:30 结束时间:2:50 总用时:20分
初始思路
记录看到题目后的第一反应、观察到的性质,以及最初准备采用的解法。 按照题目去做。
考场解题过程
记录考场上思路的发展、调整和最终采用的做法。 用一个while循环k—,每次就更新一下位置然后判断,如果这个点没走过那就ans++。
考场代码
// 在此粘贴考场代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 1e6 + 5;
const int mod = 4;
int dx[MAXN] = {0, 1, 0, -1};
int dy[MAXN] = {1, 0, -1, 0};
int n, m, k, x, y, d, vis[1005][1005];
char a[1005][1005];
void solve(){
cin >> n >> m >> k;
cin >> x >> y >> d;
for(int i = 1; i <= n; i ++){
for(int j = 1; j <= m; j ++){
cin >> a[i][j];
}
}
int ans = 1;
memset(vis, 0, sizeof(vis));
while(k --){
int nx = x + dx[d], ny = y + dy[d];
if(nx >= 1 && nx <= n && ny >= 1 && ny <= m && a[nx][ny] == '.'){
x = nx;
y = ny;
if(vis[nx][ny] == 0){
ans ++;
}
vis[nx][ny] = 1;
}
else{
d = (d + 1) % mod;
}
}
cout << ans << endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("explore.in", "r", stdin);
//freopen("explore.out", "w", stdout);
int t;
cin >> t;
while(t --){
solve();
}
return 0;
}赛后题解
用自己的语言整理本题的正确思路、关键结论和算法流程。 就是在原来的基础上把vis[x][y]标为一。
补题代码
// 在此粘贴考场代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 1e6 + 5;
const int mod = 4;
int dx[MAXN] = {0, 1, 0, -1};
int dy[MAXN] = {1, 0, -1, 0};
int n, m, k, x, y, d, vis[1005][1005];
char a[1005][1005];
void solve(){
cin >> n >> m >> k;
cin >> x >> y >> d;
for(int i = 1; i <= n; i ++){
for(int j = 1; j <= m; j ++){
cin >> a[i][j];
}
}
int ans = 1;
memset(vis, 0, sizeof(vis));
vis[x][y]=1;
while(k --){
int nx = x + dx[d], ny = y + dy[d];
if(nx >= 1 && nx <= n && ny >= 1 && ny <= m && a[nx][ny] == '.'){
x = nx;
y = ny;
if(vis[nx][ny] == 0){
ans ++;
}
vis[nx][ny] = 1;
}
else{
d = (d + 1) % mod;
}
}
cout << ans << endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("explore.in", "r", stdin);
//freopen("explore.out", "w", stdout);
int t;
cin >> t;
while(t --){
solve();
}
return 0;
}复杂度
时间复杂度:t*k 空间复杂度: 本题总结 记录本题出现的问题、值得保留的做法以及赛后的主要收获。
T2:小木棍
本题得分:0分 开始时间:2:55 结束时间:3:30 总用时:35分
初始思路
先定首位.
考场解题过程
定完首位,就从大到小枚举每个数所需的根数,如果可以就放到一个数组里。
考场代码
// 在此粘贴考场代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 1e6 + 5;
int shuliang[MAXN] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int n, a[1005][1005], cnt = 0, b[MAXN];
void solve(){
cin >> n;
if(n < 2){
cout << -1 << endl;
return ;
}
cnt = 0;
for(int i = 1; i <= 9; i ++){
if(n == shuliang[i]){
cout << i << endl;
return ;
}
}
int mini = 1e9;
for(int i = 1; i <= 9; i ++){
int x = n - shuliang[i];
cnt = 1;
a[i][cnt] = i;
while(x != 0){
if(x < 2){
break;
}
for(int j = 0; j <= 9; j ++){
if(x >= shuliang[j]){
x -= shuliang[j];
cnt ++;
a[i][cnt] = j;
break;
}
}
}
b[i] = cnt;
if(x != 0){
b[i] = 0;
}
}
for(int i = 1; i <= 9; i ++){
int cheng = 1, num = 0;
for(int j = b[i]; j >= 1; j --){
num += a[i][j] * cheng;
cheng *= 10;
}
mini = min(mini, num);
}
if(mini == 0){
cout << -1 << endl;
return ;
}
cout << mini << endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int t;
cin >> t;
while(t --){
solve();
}
return 0;
}赛后题解
我们从特殊性质就可以知道这是一道分类讨论题,当n%7==0,那就全输出7,不然 n%7==1,输出1和0在全输出8,n%7==2,输出1然后全输出8,n%7==3的时候判断n如果等于10那就输出22,不然就输出200剩下的就输出8,n%7==4,输出2和0在全输出8,n%7==5,输出2在全输出8,最后就输出6,再全输出8。
补题代码
// 在此粘贴考场代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 1e6 + 5;
int n;
int shuliang[MAXN] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
void solve(){
cin >> n;
if(n < 2){
cout << -1;
}
else if(n == 17){
cout << 200;
}
else if(n < 7){
for(int i=1; i<=9; i++)
{
if(shuliang[i]==n)
{
cout<<i;
break;
}
}
}
else if(n % 7 == 0){
for(int i = 1; i <= n / 7; i ++){
cout << 8;
}
}
else if(n % 7 == 1){
cout << 1 << 0;
for(int i = 1; i <= n / 7 - 1; i ++){
cout << 8;
}
}
else if(n % 7 == 2){
cout << 1;
for(int i = 1; i <= n / 7; i ++){
cout << 8;
}
}
else if(n % 7 == 3){
if(n==10)
cout<<"22";
else
{
cout<<"200";
for(int i = 1; i <= n / 7 - 2; i ++){
cout << 8;
}
}
}
else if(n % 7 == 4){
cout << 2 << 0;
for(int i = 1; i <= n / 7 - 1; i ++){
cout << 8;
}
}
else if(n % 7 == 5){
cout << 2;
for(int i = 1; i <= n / 7; i ++){
cout << 8;
}
}
else{
cout << 6;
for(int i = 1; i <= n / 7; i ++){
cout << 8;
}
}
cout << endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int t;
cin >> t;
while(t --){
solve();
}
return 0;
}复杂度
时间复杂度:o(1) 空间复杂度: 本题总结
T3:________________
本题得分: 开始时间: 结束时间: 总用时:
初始思路
考场解题过程
考场代码
// 在此粘贴考场代码
赛后题解
补题代码
// 在此粘贴考场代码
复杂度
时间复杂度: 空间复杂度:
本题总结
T4:________________
本题得分: 开始时间: 结束时间: 总用时:
初始思路
考场解题过程
考场代码
// 在此粘贴考场代码
赛后题解
补题代码
// 在此粘贴考场代码
复杂度
时间复杂度: