CET and miniskirt(思维题)
程序员文章站
2022-03-24 14:12:34
...
思路:
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
int cnta1=0,cntb1=0,cntc1=0,cntd1=0;
string s;
cin >> s;
for(int i=0;i<s.length();i++)
{
if(s[i]=='A')
{
cnta1++;
}
if(s[i]=='B')
{
cntb1++;
}
if(s[i]=='C')
{
cntc1++;
}
if(s[i]=='D')
{
cntd1++;
}
}
int cnta2,cntb2,cntc2,cntd2;
cin >> cnta2 >> cntb2 >> cntc2 >> cntd2;
// cout << cnta1<<" "<<cntb1<<" "<<cntc1<<" "<<cntd1<<endl;
// cout <<cnta2<<" "<<cntb2<<" "<<cntc2<<" "<<cntd2<<endl;
int flag=0;
if(cnta2>cntb1+cntc1+cntd1)
{
cout << (cnta2-(cntb1+cntc1+cntd1));
flag=1;
}
else if(cntb2>cnta1+cntc1+cntd1)
{
cout << (cntb2-(cnta1+cntc1+cntd1));
flag=1;
}
else if(cntc2>cnta1+cntb1+cntd1)
{
cout << (cntc2-(cnta1+cntb1+cntd1));
flag=1;
}
else if(cntd2>cnta1+cntc1+cntb1)
{
cout << (cntd2-(cnta1+cntc1+cntb1));
flag=1;
}
if(flag==0)
{
cout << "orz";
}
}
上一篇: 终于明白他为什么单身了
下一篇: 比妈妈还凶得那条狗
推荐阅读
-
一道有意思的思维题 --- 排序、枚举
-
loj#2509. 「AHOI / HNOI2018」排列(思维题 set)
-
洛谷P4424 [HNOI/AHOI2018]寻宝游戏(思维题)
-
AtCoder Beginner Contest 173(E 思维模拟 F 容斥 思维题 )
-
hdu 5671 Matrix(BC——思维题)
-
cf1282C 贪心 思维题
-
Distinct Sub-palindromes(思维题)
-
A. Add Odd or Subtract Even(思维题) Codeforces Round #624 (Div. 3)
-
Educational Codeforces Round 60 (Rated for Div. 2) ----A - Best Subsegment(思维题)
-
LeetCode-1073 负二进制数相加(思维题)