主页
搜索
最近更新
数据统计
申请密钥
批量保存
开发版网站(新前端)
系统公告
1
/
1
请查看完所有公告
8.28
最后更新于 2025-08-28 14:42:49
作者
huanzhenyang0420
分类
个人记录
复制 Markdown
查看原文
转到新前端
删除文章
更新内容
# 今日比赛[8.28](https://www.luogu.com.cn/contest/273101) ::::::info[T1]{open} ## [U593675](https://www.luogu.com.cn/problem/U593675?contestId=273101) :::::success[赛时代码&得分] $$ \color{green}{Accepted\not100tps} $$ ```cpp line-numbers #include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int a,b,n; cin>>n>>a>>b; for(int i=1;i<=n;i++){ int c; cin>>c; if(c==a+b){ cout<<i; return 0; } } return 0; } ``` ::::: :::::: ::::::info[T2]{open} ## [U593858](https://www.luogu.com.cn/problem/U593858?contestId=273101) :::::warning[题意] ### 题意分析: $$ 不能出现以下情况 $$  所以可以直接模拟四个方向是否为 ''#''即可(注意需要记录它的大小) # 重要的事情说三遍!!! > 令 $n = \min(h, w)$。记大小为 $n$ 的“叉叉”个数为 $S_n$。请计算 $S_1, S_2, \dots, S_n$。 > > 令 $n = \min(h, w)$。记大小为 $n$ 的“叉叉”个数为 $S_n$。请计算 $S_1, S_2, \dots, S_n$。 > > 令 $n = \min(h, w)$。记大小为 $n$ 的“叉叉”个数为 $S_n$。请计算 $S_1, S_2, \dots, S_n$。 ::::: :::::warning[赛时代码&得分] $$ \color{red}{Wrong Answer\not10tps} $$ ```cpp line-numbers #include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++) cout<<0<<" "; return 0; } ``` ::::: :::::success[正确代码] ```cpp line-numbers #include<bits/stdc++.h> using namespace std; #define endl '\n' typedef long long ll; const int N=2e2+10; int n,m,t[N]; char a[N][N]; int check(int x,int y){ int cnt[5]={}; int dx=-1,dy=-1; int xx=x+dx,yy=y+dy; while(a[xx][yy]=='#'){ cnt[1]++; xx+=dx;yy+=dy; } dx=-1,dy=1; xx=x+dx,yy=y+dy; while(a[xx][yy]=='#'){ cnt[2]++; xx+=dx;yy+=dy; } dx=1,dy=-1; xx=x+dx,yy=y+dy; while(a[xx][yy]=='#'){ cnt[3]++; xx+=dx;yy+=dy; } dx=1,dy=1; xx=x+dx,yy=y+dy; while(a[xx][yy]=='#'){ cnt[4]++; xx+=dx;yy+=dy; } sort(cnt+1,cnt+1+4); return cnt[1]; } int main(){ cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='#')t[check(i,j)]++; } } for(int i=1;i<=min(n,m);i++){ cout<<t[i]<<" "; } return 0; } ``` ::::: :::::: ::::::info[T3]{open} ## [U593859](https://www.luogu.com.cn/problem/U593859?contestId=273101) :::::warning[题意] ### 题意分析: $$ 首先使用埃氏筛找出符合条件的数\\再判断这个数乘以其他的数是否大于n\\如果大于n,就直接结束这层循环\\否则ans++ $$ ::::: :::::warning[赛时代码&得分] $$ \color{red}{Wrong Answer\not12tps} $$ ```cpp line-numbers #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; ll a[100]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293}; ll b[100000000]; int main(){ ll num=0,n; cin>>n; for(ll i=1;i<=62;i++){ for(ll j=i+1;j<=62;j++){ for(ll k=j+1;k<=62;k++){ num++; b[num]=a[i]*a[i]*a[j]*a[k]*a[k]; } } } sort(b+1,b+num+1); cout<<lower_bound(b+1,b+1+num,n)-b-1; return 0; } ``` ::::: :::::success[正确代码] ```cpp line-numbers #include<bits/stdc++.h> #define ll long long using namespace std; const int N=2e7+5; ll zs[N],flag[N]; ll n; ll ans=0; void getprime(ll n){ for(ll i=2;i<=n;i++){ if(flag[i]==1) continue; zs[++zs[0]]=i; for(ll j=2;i*j<=n;j++) flag[i*j]=1; } } int main() { cin>>n; getprime((ll)(sqrt(n))); for(ll i=1;i<=zs[0];i++){ if(zs[i]*zs[i]*zs[i]*zs[i]*zs[i]>n) break; for(ll j=i+1;j<=zs[0];j++){ if(zs[i]*zs[i]*zs[j]*zs[j]*zs[j]>n) break; for(ll k=j+1;k<=zs[0];k++){ if(zs[i]*zs[i]*zs[j]*zs[k]*zs[k]>n) break; ans++; } } } cout<<ans; return 0; } ``` ::::: ::::::
正在渲染内容...
点赞
0
收藏
0