REQg


  • 首页

  • 标签

  • 分类

  • 归档

  • 搜索

Codeforces Beta Round #27 (Codeforces format, Div. 2) A. Next Test

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/27/A

题意:
已有的任务个数n,以及它们的索引。
输出下一个任务的索引。可以使用的最小索引。
把相应的位置给占了,标为ture。
找第一个空位即可。

代码:

阅读全文 »

Codeforces Beta Round #65 (Div. 2) A. Way Too Long Words

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/71/A

题意:如果一个输入的字符串长度大于10,则输出头 长度-2 尾,否则输出原本字符串。

代码:

阅读全文 »

Codeforces Round #253 (Div. 2) A. Anton and Letters

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/443/A

题意:输入一段字符串,输出其中不同的字母个数。

PS:
输入的是一个字符串,它只是长的像个数组。例如{b, a, b, a}。每个字母之间有个,和空格。

代码:

阅读全文 »

Codeforces Round #271 (Div. 2) A. Keyboard

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/474/A

题意:键盘输入有误,要么左偏一格要么右偏一格,输出正确的结果。

代码:

阅读全文 »

Codeforces Round #376 (Div. 2) A. Night at the Museum

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/731/A

题意:
实现,z-a-b-c-d…….x-y-z-a这样的一个环形。
从a出发,给一个字符串,问,最短的移动距离是多少。
(26个字母的环形锁,给你密码问最走转几步)

PS:
输入:zeus
from ‘a’ to ‘z’ (1步),
from ‘z’ to ‘e’ (5步),
from ‘e’ to ‘u’ (10步),
from ‘u’ to ‘s’ (2步).
1 + 5 + 10 + 2 = 18.

代码:

阅读全文 »

Codeforces Round #197 (Div. 2) A. Helpful Maths

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/339/A

题意:
把一个求和的式子(只包含+1,+2,+3)重新排序为递增的求和式子。

比如输入3+2+1,输出1+2+3。**

代码:

阅读全文 »

Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 2) A. Splits

发表于 2019-01-29 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/964/A

题意:把一个数拆成求不同的权重,问有几种不同的拆法。(权重指相同的数的个数)

PS:

1
2
3
4
7 = 7
7 = 3 3 1
7 = 2 2 2 1
7 = 1 1 1 1 1 1 1

可以分解为 n = a * b + c,
a为权重的话,b最多=n/2.(a从2开始)
所以是n/2 + 1(+1,n可以拆为n个1)

代码:

阅读全文 »

Codeforces Round #274 (Div. 2) A. Expression

发表于 2019-01-26 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/479/A

题意:
给3个数子,不能改变排序 (1 ≤ a, b, c ≤ 10)
只能用加和乘还有括号
宁可能让结果大。

PS:
这里有2种可能没写(实际已经是已有条件的子集)

1
2
res = max(res, a * b + c);
res = max(res, a + b * c);

对于第一个,ab + c
对应a (b + c)=ab + ac
当a=1,两者相同,a>1,后者大。
同理后一个,a + bc
对应(a + b)
c = ac + bc
c = 1,两者相同,c>1,肯定后者大。
所以这两个条件不用判断了。

代码:

阅读全文 »

Codeforces Round #482 (Div. 2) A. Pizza, Pizza, Pizza!!!

发表于 2019-01-26 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/935/A

题意:实现,把披萨平均分成形状一样的n+1快。n个朋友,1是自己。

PS:
当要切奇数快的时候要注意
不能切直径,只能切半径
几块是几刀,3快得3刀120度才能分开
原因在于第一刀切下去它还是个圆。或则准确说成了个扇型
可以理解为一个圆得先变成一条才能再往下分

代码:

阅读全文 »

Codeforces Round #465 (Div. 2) A. Fafa and his Company

发表于 2019-01-26 | 分类于 Codeforces题解

http://codeforces.com/problemset/problem/935/A

题意:公司有n个人,把人数等分为几个小组。小组里至少一个领导和一个员工。问有几种分法。

代码:

阅读全文 »
1…345…8

REQg

78 日志
4 分类
22 标签
© 2020 REQg
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4
浙ICP备 - 19004121号