A

link



其实,有人赢比赛,就有人输比赛,一加一减,不管进行多少场比赛,最后所有人的分数和一定是\(0\)。

那么知道\(n-1\)个人的分数和,就可以知道第\(n\)个人的了。

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

using namespace std;

int n;
int sum;
int a[105]; signed main(){ cin >> n;
for(int i = 1;i < n;++ i)
cin >> a[i],sum += a[i]; cout << -1*sum; return 0; }

B

link



存下来每个字母有多少个,字符串中有的字母中是\(i\)个的字母是否为\(0\)或\(2\)个。

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

using namespace std;

char s[105];
int n;
map<char,int> mp;
int f[30]; signed main(){ cin >> s+1;
n = strlen(s+1); for(int i = 1;i <= n;++ i)
f[s[i]-'a'] = 1,mp[s[i]]++; for(int i = 1;i <= n;++ i){
int g = 0;
for(int j = 0;j < 26;++ j){
if(f[j]){
if(mp[j+'a'] == i) g++;
}
}
if(g != 0&&g != 2){
cout << "No";
return 0;
}
} cout << "Yes"; return 0; }

C

link



顺着找。

先找到第一个\(t_1\),再在这个位置往后找第一个\(t_2\),然后在\(t_2\)的位置往后找\(t_3\)。

不管从那个位置开始找不到了,都不行。

但是如果找不到\(t_3\),如果\(t_3\)是\(X\),就可以不找到。

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

#define int long long

using namespace std;

char s[100005];
char t[5];
int sl,tl; signed main(){ cin >> s+1 >> t;
sl = strlen(s+1); int w = 0;
for(int i = 1;i <= sl;++ i){
if(s[i] == t[0]-'A'+'a'){
w = i;
break;
}
} if(w == 0){
cout << "No";
return 0;
} int ww = 0;
for(int i = w+1;i <= sl;++ i){
if(s[i] == t[1]-'A'+'a'){
ww = i;
break;
}
} if(ww == 0){
cout << "No";
return 0;
} int w3 = 0;
for(int i = ww+1;i <= sl;++ i){
if(s[i] == t[2]-'A'+'a'){
w3 = i;
break;
}
} if(w3 == 0&&t[2] != 'X'){
cout << "No";
return 0;
} cout << "Yes"; return 0; }

随机推荐

  1. 设置 ASP.NET Core Web API 中响应数据的格式 AddNewtonsoftJson 使用NewtonsoftJson替换掉默认的System.Text.Json序列化组件

    #region 使用NewtonsoftJson替换掉默认的json序列化组件 .AddNewtonsoftJson(options => { 修改属性名称的序列化方式,首字母小写 //opti ...

  2. 《HelloGitHub》第 98 期

    兴趣是最好的老师,HelloGitHub 让你对编程感兴趣! 简介 HelloGitHub 分享 GitHub 上有趣.入门级的开源项目. https://github.com/521xueweiha ...

  3. nginx map模块使用和配置

    主机 IP 备注 master1 10.0.0.63 master2 10.0.0.64 1. NGINX MAP模块与NGINX GEO模块 在通常情况下,使用nginx基于 ip 限制访问请求频率 ...

  4. Leetcode-937-Reorder Log Files-(Easy)

    一.题目描述 You have an array of logs.  Each log is a space delimited string of words. For each log, the ...

  5. NOIP模拟49

    虚伪的眼泪,会伤害别人,虚伪的笑容,会伤害自己. 前言 暑假集训过后的第一次考试,成绩一般,没啥好说的 T1 Reverse 解题思路 看到这个题的第一眼就感觉是最短路,毕竟题目的样子就好像之前做过的 ...

  6. Qt-绘图设备

    1  简介 参考视频:https://www.bilibili.com/video/BV1XW411x7NU?p=40 Qt绘图设备有三种:QPixmap.QBitmap.QImage.QPictur ...

  7. (八十八)c#Winform自定义控件-转子

    官网 http://www.hzhcontrols.com/ 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kw ...

  8. vs2019 调试服务器代码

    前言&使用背景: 又是我,一个不是在解决bug就是在解决bug路上的黄金程序员.今天给大家介绍一种方法是vs自带的调试工具.通常我们会遇见一种情况,那就是本地调试没有一点问题! 可一但发布到服 ...

  9. WXS 模块

    https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxs/01wxs-module.html 2.1.概述 WXS(Wei ...

  10. 小米 红米 Redmi MIUI14 ANDROID 系统 耗电

    小米 红米 Redmi MIUI14 ANDROID 系统 耗电 在系统更新里,点右上角三点,下载完整更新包,安装好.再把电量用到关机,充电,充满开机,别拔线,继续充10分钟.我就是这么解决的,今天用 ...