Skip to content

Commit 717bf00

Browse files
committed
一大波提交
1 parent 9bb0be0 commit 717bf00

File tree

111 files changed

+8096
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+8096
-42
lines changed

1355/A /Codeforces/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright loyinglin. All rights reserved.
77

88
/************************** 题解 **********************
9-
[题目链接](http://codeforces.com/contest/1355/problem/A)
9+
[题目链接](https://codeforces.com/contest/1355/problem/A)
1010
**题目大意:**
1111
给出一个整数a[1],假设有下面这样一个迭代公式:
1212

1355/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#已写

1401/A /Codeforces/main.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,37 @@
66
// Copyright loyinglin. All rights reserved.
77

88
/************************** 题解 **********************
9-
[题目链接](http://codeforces.com/contest/1401/problem/A)
9+
[题目链接](https://codeforces.com/contest/1401/problem/A)
1010
**题目大意:**
1111
在数轴上,有一个点A放在x=n的位置上,现在想找到一个点B,B的所在位置是一个整数,并且满足:
1212
原点O到B的距离 和 A到B的距离 两者的差为k;
1313
1414
有时候该位置不存在,我们可以每次把A的位置加1,现在想知道A最少需要加几次1,使得点B存在;
1515
1616
**输入:**
17-
17+
第一行整数 𝑡,表示t个样例 (1≤𝑡≤6000)
18+
每个样例一行,整数𝑛 and 𝑘 (0≤𝑛,𝑘≤1e6)
1819
1920
**输出:**
21+
每个样例一行,输出最少都要A点移动次数。
2022
2123
**Examples**
2224
**input**
23-
24-
25+
6
26+
4 0
27+
5 8
28+
0 1000000
29+
0 0
30+
1 0
31+
1000000 1000000
2532
**output**
26-
33+
0
34+
3
35+
1000000
36+
0
37+
1
38+
0
39+
2740
**题目解析:**
2841
假如B没有整数的要求,那么当n>=k的时候,则B肯定存在于O到A之间;n<k的时候,则A的位置不断加1,直到n=k;
2942
当增加B的位置为整数限制时,即使n>=k(比如说n=1,k=0),由于B的位置是0.5,此时只能将A的位置加1,使得A=2;

1401/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#已写

1527/B1/Codeforces/main.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,34 @@
66
// Copyright loyinglin. All rights reserved.
77

88
/************************** 题解 **********************
9-
[题目链接](http://codeforces.com/contest/1527/problem/B)
9+
[题目链接](http://codeforces.com/contest/1527/problem/B1)
1010
**题目大意:**
11-
11+
ALICE和BOB在玩一个游戏,给出一个长度为n的回文字符串,由字符0和1组成;
12+
两个人轮流行动,ALICE先行动,每次有两个选择:
13+
1、花费代价1,将字符串某个字符0变成1;
14+
2、翻转(reverse)字符串,要求是该字符串不是回文串,并且上一步操作不是翻转;
15+
等整个字符串都是1的时候,游戏结束,花费代价较少的人获胜;
1216
1317
1418
1519
**输入:**
16-
第一行是整数t,表示有t个样例(1≤𝑡≤1e4).
17-
每个样例一行,第一行是整数n(1≤𝑛≤1e9).
20+
第一行是整数t,表示有t个样例 (1≤𝑡≤1e3)
21+
每个样例2行,第一行是整数 𝑛 (1≤𝑛≤1e3).
22+
第二行是01字符串;
1823
**输出:**
19-
每个样例一行,输出1到n的整数中,有多少个由相同数字组成的数。
24+
每个样例一行,输出胜者名字(ALICE和BOB);如果平局则输出(DRAW);
2025
2126
2227
**Examples**
2328
**input**
24-
6
25-
1
2629
2
27-
3
2830
4
29-
5
30-
100
31-
32-
**output**
31+
1001
3332
1
34-
2
35-
3
36-
4
37-
5
38-
18
33+
0
34+
**output**
35+
BOB
36+
BOB
3937
4038
4139

1527/B2/Codeforces/main.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,39 @@
88
/************************** 题解 **********************
99
[题目链接](http://codeforces.com/contest/1527/problem/B2)
1010
**题目大意:**
11-
11+
ALICE和BOB在玩一个游戏,给出一个长度为n的字符串,由字符0和1组成;
12+
两个人轮流行动,ALICE先行动,每次有两个选择:
13+
1、花费代价1,将字符串某个字符0变成1;
14+
2、翻转(reverse)字符串,要求是该字符串不是回文串,并且上一步操作不是翻转;
15+
等整个字符串都是1的时候,游戏结束,花费代价较少的人获胜;
1216
1317
1418
1519
**输入:**
16-
第一行是整数t,表示有t个样例(1≤𝑡≤1e4).
17-
每个样例一行,第一行是整数n(1≤𝑛≤1e9).
20+
第一行是整数t,表示有t个样例 (1≤𝑡≤1e3)
21+
每个样例2行,第一行是整数 𝑛 (1≤𝑛≤1e3).
22+
第二行是01字符串;
1823
**输出:**
19-
每个样例一行,输出1到n的整数中,有多少个由相同数字组成的数。
24+
每个样例一行,输出胜者名字(ALICE和BOB);如果平局则输出(DRAW);
2025
2126
2227
**Examples**
2328
**input**
24-
6
25-
1
26-
2
2729
3
28-
4
29-
5
30-
100
31-
32-
**output**
33-
1
34-
2
3530
3
31+
110
32+
2
33+
00
3634
4
37-
5
38-
18
35+
1010
36+
**output**
37+
ALICE
38+
BOB
39+
ALICE
3940
4041
4142
43+
4244
**题目解析:**
4345
这里有一个简单策略:对于一个回文串(最中间的数字不为0),那么可以采取A填哪个位置,B就填回文串对应的位置;
4446
直到剩下2个0的时候,A填任何一个位置,B选择reverse;此时A只能再填一次0,B必胜;
@@ -57,8 +59,8 @@
5759
假如字符串没有任何位置可以操作1次,之后变成回文串,那么先手者Alice可以reverse,等待后手者操作后,依旧可以执行reverse;(这种策略可以占领1的优势,因为后手在一直补齐)
5860
直到存在一个操作,可以对某个位置k进行操作,并且操作之后字符串变成回文串strK;
5961
1、假如f(strK)=1,则Alice可以继续执行reverse操作,因为bob如果将字符串操作为strK,对Alice是有收益的;
60-
2、假如f(strK)=-1,则Alice继续执行reverse会平局,因为bob花费1的代价让让alice面临-1的情况;(是否平局,取决于在达到下一步操作就能生成回文串的操作步数)
61-
2、假如f(strK)=-2,则Alice必胜,Alice花费1的代价可以让对手面临-2的情况;
62+
2、假如f(strK)=-1,则Alice继续执行reverse会平局,因为bob花费1的代价让让alice面临-1的情况; (是否平局,取决于在达到下一步操作就能生成回文串的操作步数)
63+
3、假如f(strK)=-2,则Alice必胜,Alice花费1的代价可以让对手面临-2的情况;
6264
6365
这里可以推出来,先手者必然不会输。(注意,这个前提是有2个0以上)
6466

1527/C/Codeforces/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright loyinglin. All rights reserved.
77

88
/************************** 题解 **********************
9-
[题目链接](http://codeforces.com/contest/1527/problem/C)
9+
[题目链接](https://codeforces.com/contest/1527/problem/C)
1010
**题目大意:**
1111
有n个整数的数组,对于一个数组的weight,定位数组中所有的[i, j],有多少个满足a[i]==a[j];
1212
问数组的所有子数组中,所有的weight有多少。

1527/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#已写

0 commit comments

Comments
 (0)