coduck 2023CSP-J复赛模拟赛四补题报告

coduck 2023CSP-J复赛模拟赛四补题报告

2023年10月5日

S08572

1.比赛分数

T1一百分,T3一百分,T2T4爆零

2.比赛过程

先做了半个小时T1,然后调代码调了一个半小时,然后再看了看T2和T3,觉得T3简单(因为T3是一道SPJ题),然后坐了半小时T3,又调了半个小时,最后还有半个小时,就简单看了看题,骗了下分,结果一分没骗到

3.题解报告

1.复读机(repeater)

情况:赛中AC

AC代码: 

#include<iostream>
#include<string>//需要字符串所以要用string的头文件
#include<cstdio>
using namespace std;
int main(){
//	freopen("repeater.in","r",stdin);比赛不写freopen就相当于坐等爆零
//	freopen("repeater.out","w",stdout);
    int t;//这里的数据范围是t不超过100,所以肯定不用开long long
    cin >> t;
    while (t--){
        int n;
        string a;
        cin >> n >> a;
        int x=0;
        int f=1;
        string b,ans;
        for (long long i = 0;i < n;i++){//当然这个地方i也可以是int类型
            if (a[i] >= 'a' && a[i] <= 'z'){
                if (!f){
                    for (long long i = 1;i <= x;i++){
                        b += ans;
                    }
                    x = 0;
                    ans = b;
                    b ="";
                    f=1;
                }
                ans += a[i];//把违规的也都拿过来
            }
            else{
                if (f){//也可以写成if(f!=0)当然都可以
                    x = 0;
                    f=0;
                }
                x *= 10;
                x +=a[i] - '0';
            }
        }
        x--;
        if (x >= 1){
            b = ans;
            for (long long i = 1;i <= x;i++){
                b += ans;
            }
            ans = b;
        }
        cout << ans <<endl;
    }
//    fclose(stdin);
//    fclose(stdout);
    return 0;
}
2.小可的矛与盾(spearshield)

赛时爆零,已补题

AC代码:

#include <iostream>
#include <cstdio>
using namespace std;
const int N = 1e6 + 10;
int main (){
//	freopen ( "spearshield.in","r",stdin );
//	freopen ( "spearshield.out","w",stdout );
    long long n;
    string s;
    cin >> n >> s;
    s = " " + s;
    long long pre1[100010], pre0[100010];
    for(int i = 1; i <= n; i++){
        pre1[i] = pre1[i-1] + (s[i] == '1') * i;
        pre0[i] = pre0[i-1] + (s[i] == '0') * i;
    }
    long long ans = N;
    for(int i = 1; i <= n; i++){
        ans = min(ans, abs(pre0[i-1] - (pre1[n] - pre1[i-1])));
    }
    cout << ans << endl;
//    fclose ( stdin );
//    fclose ( stdout );
    return 0;
}
3.不合法字符串(illegality)

一道SPJ题,赛时AC

 好吧我个人认为这道题比第二题简单

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
int main(){
//	freopen ("illegality.in","r",stdin);
//	freopen ("illegality.out","w",stdout);
	long long t;
	cin>>t;
	for(long long i=1;i<=t;i++){
		long long n,len;
		string buhefa;
		cin>>n;
		string nohefa,xiaoshuo;
		for(int k=1;k<=n;k++){
			cin>>nohefa; 
			buhefa[k]=nohefa[0];
		}
		cin>>xiaoshuo;
		len=xiaoshuo.length();
		for(long long j=0;j<len;++j){
			for(int k=1;k<=n;++k){
				if(xiaoshuo[j]==buhefa[k]){
					xiaoshuo[j]='*';
				}
			}
		}
		cout<<xiaoshuo<<endl;
	}
//	fclose (stdin);
//	fclose (stdout);
	return 0;
}
4.虚假的珂朵莉树(kodori)

老觉得这题有股二次元的味道和鲁迅的味道。。。(虽然这道题并没有听懂)

在我的后园,可以看见墙外有两株树,一株是枣树,还有一株也是枣树。

——鲁迅

正解:

4.比赛总结

我考的这四次模拟赛最好的一次,希望明天能更好

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

s08572

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值