欢乐赛#78|非官方题解
2026-07-30 10:07:55
发布于:河北
| 题目编号 | 题目标题 | 涉及知识点 | 难度 |
|---|---|---|---|
| T1 | 皓仔的BMI | 算术运算符 | 入门 |
| T2 | 皓仔的体重等级 | 分支结构 | 入门 |
| T3 | 皓仔的字母变化 | 字符串 | 入门 |
| T4 | 皓仔的寻宝之路 | 模拟 | 入门 |
| T5 | 皓仔的数组检测 | 素数 | 普及- |
| T6 | 皓仔的矩阵魔法 | 二维数组 | 普及- |
作者在这里补充
呃呃呃我觉得第六题应该是入门的难度啊 希望AC君可以修改一下
T1解题思路:
T1
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
double w,h;
cin>>h>>w;
printf("%.2lf",w/(pow(h,2)));
return 0;
}
T2解题思路:
T2
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
double sg,tz;
cin>>sg>>tz;
double ans=tz/(pow(sg,2))*1.00;
if(ans<18.5){
cout<<"偏瘦"<<endl;
}else if(ans<24){
cout<<"正常"<<endl;
}else if(ans<28){
cout<<"超重"<<endl;
}else{
cout<<"肥胖"<<endl;
}
return 0;
}
T3解题思路:
T3
#include<bits/stdc++.h>
using namespace std;
signed main(){
string s;
int n;
getline(cin,s);
cin>>n;
n%=26;
for(int i=0;i<s.size();i++){
if(s[i]>='a'&&s[i]<='z'){
char c;
int ans=0;
int a=int(s[i]-'a')+26;
a-=n;
a++;
if(a%26)a%=26;
a+=96;
//cout<<"a="<<" "<<a;
c=char(a);
cout<<c;
}else if(s[i]>='A'&&s[i]<='Z'){
char c;
int ans=0;
int a=int(s[i]-'A');
a+=n;
a++;
if(a%26)a%=26;
a+=65;
a--;
//cout<<"a="<<" "<<a;
c=char(a);
cout<<c;
}else{
cout<<s[i];
}
}
cout<<endl;
return 0;
}
T4解题思路:
T4
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e3+10;
int a[N];
char c[N];
int t[N];
signed main(){
int n,m,x;
string s;
cin>>m>>x>>n;
for(int i=1;i<=m;i++){
cin>>a[i];
}
cin>>s;
for(int i=0;i<n;i++){
c[i+1]=s[i];
}
int ans=0;
for(int i=1;i<=n;i++){
int k;
if(c[i]=='L'){
if(/*!t[x-1]&&*/x-1>=1){
ans+=a[x-1];
x--;
t[x-1]=1;
}
}else{
if(/*!t[x+1]&&*/x+1<=m){
ans+=a[x+1];
x++;
t[x+1]=1;
}
}
}
cout<<ans<<endl;
return 0;
}
T5解题思路:
YESNO
T5
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e2+10;
int j,o;
bool check(int x){
if(x<=1)return 0;
for(int i=2;i<=sqrt(x);i++){
if(x%i==0)return 0;
}
return 1;
}
signed main(){
int m;
cin>>m;
while(m--){
j=0;
o=0;
int n;
cin>>n;
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(i%2==0){
j+=x;
}else{
o+=x;
}
}
int jj=j;
int ans=0;
while(jj){
ans=ans*10+jj%10;
jj/=10;
}
bool cmp=false;
if(ans==j){
cmp=true;
}
if(check(o)&&cmp){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
return 0;
}
T6解题思路:
T6
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e2+10;
int n,m,q;
int a[N][N];
signed main(){
cin>>n>>m>>q;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
while(q--){
int op,x1,x2,y1,y2,v;
cin>>op>>x1>>x2>>y1>>y2>>v;
for(int i=x1;i<=y1;i++){
for(int j=x2;j<=y2;j++){
if(op==1){
a[i][j]+=v;
}else if(op==2){
a[i][j]-=v;
}else{
a[i][j]=v;
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
return 0;
}

不喜勿喷
全部评论 16
- 置顶
求求给孩子点点赞吧

2026-07-28 来自 河北
3 核子你连 都没会来写啥学术帖
2026-07-30 来自 湖北
1求大佬指点
2026-07-30 来自 河北
0https://help.luogu.com.cn/rules/academic/handbook/latex
2026-07-30 来自 湖北
0
建议学习题解格式的排版规范
2026-07-28 来自 浙江
1okok感谢
2026-07-29 来自 河北
0你也得学(、
2026-07-30 来自 湖北
0
d
2026-07-28 来自 河北
1d
2026-07-28 来自 河北
1感谢参与欢乐赛#78,本次嘻哈赛累计AC选手268名,瓜分8888罐头,每人瓜分33罐头,对应罐头已发放至账户,请前往罐头明细里查看获得记录
2026-07-28 来自 浙江
1d
2026-07-28 来自 河北
1d
2026-07-28 来自 河北
11
2026-07-28 来自 河北
1不错不错
2026-07-30 来自 广东
01
2026-07-28 来自 河北
01
2026-07-28 来自 河北
01
2026-07-28 来自 河北
0d
2026-07-28 来自 河北
0d
2026-07-28 来自 河北
01
2026-07-28 来自 河北
0






































有帮助,赞一个