跳到正文

个人记录

题解

___love___约 3 分钟
原文
文章信息与版本

文章信息

收录
2026年8月10日
更新
2026年8月10日
篇幅
约 3 分钟

版本

  1. v1当前

T1

注意到你们都会直接计算 ss,这里来一种正推的枚举方法,因为 1≤k,m≤1001 \le k,m \le 100,所以 1≤s≤1001 \le s \le 100,暴力枚举就能过。

C++
for(int s = 1; s <= 100; s++)
      if(k * s + k * s + k == m) cout << s << "\n"; 

T2

注意到这题的 a,b≤100a, b \le 100,可以直接枚举你分别买了几根棒棒糖和软糖,判断钱够不够买,然后选买的最多的。

C++
for(int i = 0; i <= a; i++)
      for(int j = 0; j <= b; j++)
          if(i * x + j * y <= m)
              ans = max(ans, i + j);

T3

注意到有 66 种情况, {ai×x=yai×y=xai+x=yai+y=xx+y=aix×y=ai⇒ai={x+yx×yx−yy−xx÷yy÷x\begin{cases} a_i \times x = y\\ a_i \times y = x\\ a_i + x = y\\ a_i + y = x\\ x + y = a_i\\ x \times y = a_i \end{cases} \Rightarrow a_i = \begin{cases} x + y\\x \times y\\x - y\\y - x\\x \div y\\y \div x \end{cases}

统计每个数出现次数,考虑一下零界点,然后就可以实现。

代码
while(n--) cin >> a, t[a]++;
if(x + y <= 1000 && t[x + y]) ans1 += t[x + y], ans2 = max(ans2, x + y), t[x + y] = 0;
if(x * y <= 1000 && t[x * y]) ans1 += t[x * y], ans2 = max(ans2, x * y), t[x * y] = 0;
if(x - y > 0 && t[x - y]) ans1 += t[x - y], ans2 = max(ans2, x - y), t[x - y] = 0;
if(y - x > 0 && t[y - x]) ans1 += t[y - x], ans2 = max(ans2, y - x), t[y - x] = 0;
if(x % y == 0 && t[x / y]) ans1 += t[x / y], ans2 = max(ans2, x / y), t[x / y] = 0;
if(y % x == 0 && t[y / x]) ans1 += t[y / x], ans2 = max(ans2, y / x), t[y / x] = 0;

T4

简单模拟就可以。

T5

这题看懂题目就很简单,因为有 10≤x,y≤9910 \le x, y \le 99,所以直接枚举 x,yx, y,然后按照题目的流程模拟判断是否能变成输入的 x,yx, y。

C++
for(int i = 10; i <= 99; i++)
    for(int j = 10; j <= 99; j++){
        x = i, y = j;
        ..........\\ 模拟题目过程
        if(x == xx && y == yy) ans++;
	}

T6

这题实质上就是就是看每个字母的前一个是不是元音字母,如果是就大写输出。

C++
while(n--){
    cin >> s;
    cout << char(s[0] - 'a' + 'A');
    for(int i = 1; i < s.size(); i++)
        if(s[i - 1] == ......) //判断是不是元音字母
            cout << char(s[i] - 'a' + 'A');
    cout << "\n";
}
原文