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. [NOIP2000 提高组] 单词接龙

    传送锚点:https://www.luogu.com.cn/problem/P1019 题目描述 单词接龙是一个与我们经常玩的成语接龙相类似的游戏,现在我们已知一组单词,且给定一个开头的字母,要求出以 ...

  2. Anaconda 虚拟环境

    1. 查看虚拟环境 conda env list 2. 创建虚拟环境 conda create -n env_name python=3.8 --- env_name: 虚拟环境名 --- pytho ...

  3. 一个与 WSL2 建立远程的简单方法

    前言 众所周知,windows 会通过虚拟交换机给本机和 wsl2(Linux 子系统)分别分配 ip.于是本机重启或重启 wsl 服务的时候会重新分配 ip.之前所作的端口转发,监听之类的都会失效. ...

  4. windows下IPv4通信(C++、MFC)

    Cilect #include <stdio.h> #include <Ws2tcpip.h> #include <winsock2.h> #define HELL ...

  5. OOP课第一阶段总结

    前三次OOP作业总结Blog 前言 作为第一次3+1的总结,这次题目集的难度逐渐升高,题量.阅读量和测试点的数量变化都很大,所以对我们的编程和理解能力提出了更高的要求.要求我们能够熟练的掌握正则表达式 ...

  6. SMOGN算法Python实现:解决回归分析中的数据不平衡

      本文介绍基于Python语言中的smogn包,读取.csv格式的Excel表格文件,实现SMOGN算法,对机器学习.深度学习回归中,训练数据集不平衡的情况加以解决的具体方法.   在不平衡回归问题 ...

  7. echarts的示例跟做出来的不一样

    先给大家看下我做出来的和echarts官网做出来的 代码什么的都是一模一样但是颜色不一样 它字的颜色和柱状图颜色还一样不知道是不是脑子有猫病~ 上面是我做的  下面是官网的 主要是代码都是一样 我又不 ...

  8. 程序员面试金典-面试题 01.03. URL化

    题目: URL化.编写一种方法,将字符串中的空格全部替换为%20.假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的"真实"长度.(注:用Java实现的话,请使用字符数组实 ...

  9. LeetCode 146. LRU CacheLRU缓存机制 (C++/Java)

    题目: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the ...

  10. kettle从入门到精通 第十七课 kettle Transformation executor

    Transformation executor步骤是一个流程控件,和映射控件类似却又不一样. 1.子转换需要配合使用从结果获取记录和复制记录到结果两个步骤,而子映射需要配合映射输入规范和映射输出规范使 ...