信竞日记(2025年传)
记录每天的事情
1月4日
想补题,因为看着进度榜上我的一点红,不爽。然后就开始·····
P7910 [CSP-J 2021] 插入排序
本以为水,结果,1
感觉离答案是辣么近,却改了7、8次。 最后把样例⛏下来了,交了一发,结果送了我一个Wonderful Answer,又崩了。一崩之下,换题(╯▔皿▔)╯
#include<bits/stdc++.h>
using namespace std;
struct node{
int num;
int s;
}a[8005],b[8005];
short n,q,opt,x,u;
bool cmp(node x,node y){
if(x.num ==y.num )return x.s<y.s;
else return x.num<y.num ;
}
int main(){
cin>>n>>q;
for(int i=1;i<=n;i++){
cin>>a[i].num ,a[i].s =i;
b[i].num =a[i].num ,b[i].s =a[i].s ;
}
for(int i=1;i<=q;i++){
cin>>opt;
if(opt==1){
cin>>x>>u;
a[x].num=u;
}else{
cin>>x;
for(int i=1;i<=n;i++){
b[i].num =a[i].num ;
}
sort(b+1,b+n+1,cmp);
for(int i=1;i<=n;i++){
if(b[i].num ==a[x].num ){
cout<<b[i].s <<endl;
break;
}
}
}
}
return 0;
}
切割三角形
看了一眼样例,就换题了,看不懂啊,(′⌒`)。
经过一番辗转反侧,最后选择做AtCoder上的题,可考完了就看不见题目了,结果洛谷上有题单,感谢洛谷3秒。
在最后成功完成 AT_tenka1_2012_9,🎇,高兴。
#include<bits/stdc++.h>
using namespace std;
short n,cnt;
bool check(int x){
for(int i=2;i<=x-1;i++){
if(x%i==0){
return false;
}
}
return true;
}
int main(){
cin>>n;
for(int i=2;i<n;i++){
if(check(i)==true)cnt++;
}
cout<<cnt;
return 0;
}
以上暴力做法,其他做法作者也会(至少不是太逊),详情见其他神犇。
1月4日完。
1月17日
又一篇题解P7910 [CSP-J 2021] 插入排序 想看题解的请一步我的题解
1月18日
讲了树和二叉树,简单 做了https://junior.local.cwoi.com.cn:8443/training/K030/problem/A
https://junior.local.cwoi.com.cn:8443/training/K030/problem/B
https://junior.local.cwoi.com.cn:8443/training/K030/problem/C
https://junior.local.cwoi.com.cn:8443/training/K030/problem/D
https://junior.local.cwoi.com.cn:8443/training/K030/problem/H
https://junior.local.cwoi.com.cn:8443/training/K030/problem/F
一道题https://junior.local.cwoi.com.cn:8443/training/K030/problem/F 完美的展示了玄学,两个并列的if语句,调换顺序前
1月19日
做完了树和二叉树的所有题目。 https://junior.local.cwoi.com.cn:8443/training/K030/problem/E https://junior.local.cwoi.com.cn:8443/training/K030/problem/G https://junior.local.cwoi.com.cn:8443/training/K030/problem/I 感谢@ Float_jay ,帮我调了一下题。