上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2072 题意 每行输入由小写字母和空格组成,统计每行中不同的单词数。 题解 题解一 比较简洁的解法,读入每行输入后重定向至字符流 $stringstream$,与 uva10815 相似。 代码 #inc 阅读全文
posted @ 2020-07-04 18:40 Kanoon 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1270 A. Card Game 题意 有两个人在玩卡牌游戏,规则如下: 共有 $n$ 张牌,值为 $1$ 到 $n$ 两个人各出一张牌,牌大者拿走两张牌 手中先无牌者输掉游戏 给出一开始两个人的手牌情况(至少都有一张牌),判 阅读全文
posted @ 2020-07-03 23:55 Kanoon 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1371 A. Magical Sticks 题意 有 $n$ 根小棍,长度从 $1$ 到 $n$,每次可以将两根小棍连接起来,问最多有多少根小棍长度相同。 题解 如:1 2 3 4 5,相同长度最多的情况为 1+4 2+3 5 阅读全文
posted @ 2020-07-02 23:55 Kanoon 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:https://codeforces.com/contest/1374 A. Required Remainder 题意 给出 $x, y, n$,找到最大的整数 $0 \le k \le n$,使得 $k\ mod\ x = y$ 。 题解 $k = mx + y$,求得满足条件最大的 阅读全文
posted @ 2020-06-29 00:45 Kanoon 阅读(137) 评论(1) 推荐(1) 编辑
摘要: 比赛链接:https://atcoder.jp/contests/abc172/tasks A - Calc 题意 给出一个正整数 $a$,计算 $a + a^2 + a^3$ 。($1 \le a \le 10$) 代码 #include <bits/stdc++.h> using namespa 阅读全文
posted @ 2020-06-28 13:30 Kanoon 阅读(272) 评论(0) 推荐(1) 编辑
摘要: 题目链接:https://codeforces.com/contest/1373/problem/D 题意 给出一个大小为 $n$ 的数组 $a$,下标为 $0 \sim n - 1$,可以进行一次反转一个区间中元素的操作,问偶数下标元素的最大和, 题解 如果反转区间长度为奇数,则下标奇偶性不同的元 阅读全文
posted @ 2020-06-27 00:20 Kanoon 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/contest/1373/problem/C 题意 给出一个只含有 $+$ 或 $-$ 的字符串 $s$,按如下伪代码进行操作: res = 0 for init = 0 to inf cur = init ok = true for i = 阅读全文
posted @ 2020-06-26 23:45 Kanoon 阅读(282) 评论(2) 推荐(2) 编辑
摘要: 题目链接:https://codeforces.com/contest/1373/problem/B 题意 给出一个二进制串 $s$,Alica 和 Bob 每次可以选择移去 $s$ 中的一个 $10$ 或 $01$,无法选择者视为输掉游戏,判断最终谁会胜利。($1 \le t \le 1000, 阅读全文
posted @ 2020-06-26 23:21 Kanoon 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/contest/1373/problem/A 题意 有两种包装的甜甜圈,第一种 $1$ 个 $a$ 元,第二种 $b$ 个 $c$ 元,问买多少个甜甜圈按第一种买会更便宜,买多少个甜甜圈按第二种买会更便宜,输出任一方案。 题解 梳理过后发现本题 阅读全文
posted @ 2020-06-26 23:06 Kanoon 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/contest/1265/problem/A 题意 给出一个由 a, b, c, ? 组成的字符串,将 ? 替换为 a, b, c 中的一个字母,问能否字符串中所有相邻字母都不同。 题解 除非一开始字符串就不合法,否则一定可以构造出合法的字符串 阅读全文
posted @ 2020-06-25 18:02 Kanoon 阅读(136) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页