Codeforces Round #806 (Div. 4) ABC

A

答:是还是是?
每次测试的时间限制
1 秒
每次测试的内存限制
为 256 MB
输入
标准输入
输出
标准输出

有一个字符串ss长度33,由大写和小写英文字母组成。检查它是否等于“YES”(不带引号),其中每个字母在任何情况下都可以。例如,“yES”、“是”、“是”都是允许的。

输入

输入的第一行包含一个整数tt (1≤吨≤1031≤t≤103) — 测试用例的数量。

每个测试的描述由一行包含一个字符串组成ss由三个字符组成。每个字符ss是大写或小写的英文字母。

输出

对于每个测试用例,输出“YES”(不带引号),如果ss满足条件,否则为“NO”(不带引号)。

在任何情况下都可以输出“YES”和“NO”(例如,字符串“yES”,“yes”和“Yes”将被识别为肯定响应)。

输入
复制
10
YES
yES
yes
Yes
YeS
Noo
orZ
yEz
Yas
XES
输出
复制
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
注意

前五个测试用例包含字符串“YES”,“yES”,“yes”,“Yes”,“YeS”。所有这些都等于“YES”,其中每个字符要么是大写的,要么是小写的。

#include<bits/stdc++.h>
using namespace std;
char a[3];
int main(){
	int _;
	cin>>_;
	while(_--){
		for(int i = 1;i<=3;i++) cin>>a[i];
		if((a[1]=='y'||a[1]=='Y')&&(a[2]=='e'||a[2]=='E')&&(a[3]=='s'||a[3]=='S')){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

B 

B. ICPC气球
每次测试的时间限制
1 秒
每次测试的内存限制
为 256 MB
输入
标准输入
输出
标准输出

在ICPC比赛中,气球的分布如下:

  • 每当一个团队解决问题时,这个团队就会得到一个气球。
  • 第一个解决问题的团队会得到一个额外的气球。
A contest has 26 problems, labelled A一个BBCC, ..., ZZ. You are given the order of solved problems in the contest, denoted as a string ss, where the i我-th character indicates that the problem sisi has been solved by some team. No team will solve the same problem twice.

确定团队收到的气球总数。请注意,有些问题可能不是由任何团队解决的。

输入

The first line of the input contains an integer tt (1≤t≤1001≤吨≤100) — the number of testcases.

The first line of each test case contains an integer nn (1≤n≤501≤n≤50) — the length of the string.

The second line of each test case contains a string ss of length nn consisting of uppercase English letters, denoting the order of solved problems.

输出

对于每个测试用例,输出一个整数 — 团队收到的气球总数。

输入
复制
6
3
ABA
1
A
3
ORZ
5
BAAAA
4
BKPT
10
CODEFORCES
输出
复制
5
2
6
7
8
17
注意

In the first test case, 55 balloons are given out:

  • Problem A一个 is solved. That team receives 22 balloons: one because they solved the problem, an an additional one because they are the first team to solve problem A一个.
  • Problem BB is solved. That team receives 22 balloons: one because they solved the problem, an an additional one because they are the first team to solve problem BB.
  • Problem A一个 is solved. That team receives only 11 气球,因为他们解决了问题。请注意,他们不会得到额外的气球,因为他们不是 第一个解决问题的团队 A一个.
发放的气球总数为2+2+1=52+2+1=5.

在第二个测试用例中,只有一个问题解决了。解决它的团队收到22气球:一个是因为他们解决了问题,一个是额外的气球,因为他们是第一个解决问题的团队A一个.


#include<bits/stdc++.h>
using namespace std;
int main(){
	int _;
	cin>>_;
	while(_--){
		int ans = 0;
		int n;
		cin>>n;
		string s;
		int a[50] = {0};
		cin>>s;
		for(int i = 0;i<n;i++){		
			a[s[i]-'A']++;
			
		}
		
		for(int i = 0;i<26;i++){
			
			if(a[i]==1){
				ans+=2;
			}
			if(a[i]>1){
				ans = ans+2+a[i]-1;
			}
			//cout<<ans<<"\t";
			
		}
		cout<<ans<<endl;
	}
	return 0;
}

C 

C. 密码
每次测试的时间限制
1 秒
每次测试的内存限制
为 256 MB
输入
标准输入
输出
标准输出

卢卡有一个由一个序列组成的密码nn车轮,每个车轮都有一个数字一个我ai写在上面。在我我-第轮,他做了b我bi移动。每个移动是以下两种类型之一:

  • 向上移动(表示为UU):它增加了我我-第 1 位数字11.应用上移后继续99,它变成了00.
  • 向下移动(表示为DD):它减少了我我-第 1 位数字11.应用后向下移动00,它变成了99.

示例n=4n=4.当前序列为 0 0 0 0 0。

卢卡知道车轮的最终顺序和每个车轮的移动。帮助他找到原始序列并破解密码。

输入

第一行包含单个整数tt (1≤吨≤1001≤吨≤100) — 测试用例的数量。

每个测试用例的第一行包含单个整数nn (1≤n≤1001≤n≤100) — 车轮数量。

第二行包含nn整数一个我ai (0≤一个我≤90≤ai≤9) — 显示在我我-第 0 个轮子后执行所有移动。

然后nn线条跟随,我我其中 -th 包含整数b我bi (1≤b我≤101≤bi≤10) 和b我bi字符UUDD— 在 上执行的移动次数我我-th 轮子,并执行了移动。UUDD分别表示向上移动和向下移动。

输出

对于每个测试用例,输出nn空格分隔的数字 — 密码的初始序列。

输入
复制
3
3
9 3 1
3 DDD
4 UDUU
2 DU
2
0 9
9 DDDDDDDDD
9 UUUUUUUUU
5
0 5 9 8 3
10 UUUUUUUUUU
3 UUD
8 UUDUUDDD
10 UUDUUDUDDU
4 UUUU
输出
复制
2 1 1 
9 0 
0 4 9 6 9 
注意

在第一个测试用例中,我们可以证明初始序列是[2,1,1][2,1,1].在这种情况下,执行了以下移动:

  • 在第一个轮子上:2→D1→D0→D92→D1→D0→D9.
  • 在第二个轮子上:1→U2→D1→U2→U31→U2→D1→U2→U3.
  • 在第三个轮子上:1→D0→U11→D0→U1.
最后一个序列是[9,3,1][9,3,1],它与输入匹配。

#include <bits/stdc++.h>
using namespace std;
void ok() {
    int x;
    cin >> x;
    vector<int> v(x + 1);
    for(int i = 1; i <= x; i ++) {
        cin >> v[i];
    }
    for(int i = 1; i <= x; i ++) {
        int m; string s;
        cin >> m >> s;
        for(int j = 0; j < m; j++) {
            if(s[j] == 'D') {
            	 v[i] ++;
                if(v[i] == 10) 
                    v[i] = 0;                 
            } else {
               v[i] --;
                if(v[i] == -1) 
                    v[i] = 9;
            }
        }
    }
    for(int i = 1; i <= x; i ++) {
        cout << v[i] << ' ';
    }
    cout << endl;
}

int main() {
    int _;
    cin >> _;
    while(_ --) {
        ok();
    }
    return 0;
}

  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

超级小何

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值