A

link



这道题就先输出整个的\(oox\),再输出剩一个两个的。

点击查看代码
#include<bits/stdc++.h>

using namespace std;

int n;

signed main(){

	cin >> n;

	int t = n/3;
for(int i = 1;i <= t;++ i)
cout << "oox"; if(n%3 == 1) cout << "o";
if(n%3 == 2) cout << "oo"; return 0; }

B

link



可以用二维数组记录每个点到其他各点的距离,再找最小的。

点击查看代码
#include<bits/stdc++.h>

#define int long long

using namespace std;

int n;
int x[105],y[105];
double g[105][105]; signed main(){ cin >> n;
for(int i = 1;i <= n;++ i)
cin >> x[i] >> y[i]; for(int i = 1;i <= n;++ i){
for(int j = 1;j < i;++ j){
g[i][j] = sqrt((x[i]-x[j])*(x[i]-x[j])
+(y[i]-y[j])*(y[i]-y[j]));
g[j][i] = g[i][j];
}
} for(int i = 1;i <= n;++ i){
double mx =-1e6;
for(int j = 1;j <= n;++ j)
if(i != j) mx = max(mx,g[i][j]);
for(int j = 1;j <= n;++ j){
if(abs(g[i][j]-mx) <= 1e-6&&i != j){
cout << j << endl;
break;
}
}
} return 0; }

C

link



这个题也不难。

把每个颜色中的最小值存下来,再从这些中取最大值。

判断这个颜色之前出没出现过,新建一个位置,否则再原来的位置上再取\(min\)。

点击查看代码
#include<bits/stdc++.h>

#define int long long

using namespace std;

int n,c[200005],tp;
map<int,int> mp; signed main(){ cin >> n;
for(int i = 1;i <= n;++ i){
int a,cc;
cin >> a >> cc;
if(mp[cc]) c[mp[cc]] = min(c[mp[cc]],a);
else mp[cc] = ++tp,c[mp[cc]] = a;
} int ans = 0;
for(int i = 1;i <= tp;++ i)
ans = max(ans,c[i]); cout << ans; return 0; }

D

link



一个普普通通的广搜。

点击查看代码
#include<bits/stdc++.h>

using namespace std;

int h,w;
int a[205][205];
int n;
int r,c,e;
int sx,sy,tx,ty;
int eng[205][205];
int le[205][205];
int dx[] = {0,0,0,1,-1};
int dy[] = {0,1,-1,0,0}; struct nd{
int x,y;
}; signed main(){ cin >> h >> w;
for(int i = 1;i <= h;++ i)
for(int j = 1;j <= w;++ j){
char ch;
cin >> ch;
if(ch == '.')a[i][j] = 0;
if(ch == '#')a[i][j] = 1;
if(ch == 'S')a[i][j] = 0,sx = i,sy = j;
if(ch == 'T')a[i][j] = 0,tx = i,ty = j;
}
cin >> n;
for(int i = 1;i <= n;++ i){
cin >> r >> c >> e;
eng[r][c] = e;
} if(eng[sx][sy] == 0){
cout << "No";
return 0;
} queue<nd> q;
q.push({sx,sy});
le[sx][sy] = eng[sx][sy];
while(!q.empty()){
int x = q.front().x;
int y = q.front().y;
q.pop();
for(int i = 1;i <= 4;++ i){
int xx = x+dx[i];
int yy = y+dy[i];
if(a[xx][yy] == 1) continue;
if(xx <= 0||yy <= 0||xx > h||yy > w)
continue;
if(max(le[x][y]-1,eng[xx][yy]) > le[xx][yy]){
q.push({xx,yy});
le[xx][yy] = max(le[x][y]-1,eng[xx][yy]);
}
if(xx == tx&&yy == ty){
cout << "Yes";
return 0;
}
}
} cout << "No"; return 0; }

E

link

随机推荐

  1. CSS——阴影

    <!DOCTYPE html> <html> <head> <style> p.one { text-shadow: 3px 5px 5px #FF00 ...

  2. wordpress博客系统报错

    第一种,只显示nginx的默认网页 说明wordpress的网页配置文件没有被系统读取 我们就需要去查看nginx的配置文件/etc/nginx/conf.d/default.conf 首先,查看是不 ...

  3. xpath提取不到值(iframe嵌套)的问题

    爬取http://xgj.xiangyang.gov.cn/zwgk/gkml/?itemid=2471的时候遇到frame嵌套,内部的a标签获取不到. 网上也有人遇到了同样的问题.https://b ...

  4. 使用nginx 中转 https tls1.3 请求

    对方服务器使用的是TLS1.3,并关闭了一些算法套件,使得.NET FRAMEWORK 4.8 ..NET 5 都无法连接. 只能用中转方案解决. nginx配置: #user nobody; wor ...

  5. CM 停用 Parcel 异常

    在将Doris集成到CM时,第一次打的包存在问题,想更新下,停用.删除Parcel时出现了问题卡住了,一直显示75%.无奈换了名称和版本,分配.激活,然后又卡在了75%,点开后,发现是同一台机器.其a ...

  6. MinIO 图片转文件的分界线RELEASE.2022-05-26T05-48-41Z

    前言:本人想用MinIO存储文件,但是不想最新版本Mete文件,于是各种寻找于是终于找到办法了,原来是官方版本更新导致的.需要我们去寻找相应的版本. 1.官网下载网站 https://dl.min.i ...

  7. glog_bash:在bash中优雅输出日志

    介绍 官方仓库:https://github.com/GuoFlight/glog_bash .下载其中的glog_bash.sh即可. 这是专门用于bash脚本中的logger,名为glog_bas ...

  8. PPP协议简介

    转载出处:https://blog.csdn.net/csucxcc/article/details/1684416 PPP(Point-to-Point Protocol)协议是在SLIP的基础上发 ...

  9. Linux特殊权限之SBIT

    简单点,说话的方式简单点: 用于修饰目录 其他用户x位替换成t 作用:目录属主在该目录下创建的文件只有该属主能删除

  10. 背包DP——多重背包

    多重背包也是 0-1 背包的一个变式.与 0-1 背包的区别在于每种物品有 k 个,而非一个. 朴素 直接把相同的每个物品视作各个单独的物品,没有关联,仅条件相同: 转换后直接用01背包的状态转移方程 ...