提交 940e4986 编写于 作者: 每日一练社区's avatar 每日一练社区

update solution.md

上级 f793ca4e
......@@ -11,19 +11,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
18
```
## 选项
......@@ -31,18 +31,18 @@
### A
```cpp
```c
19
```
### B
```cpp
```c
20
```
### C
```cpp
```c
21
```
......@@ -11,20 +11,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
long pow_2(int b)
{
long x = 2;
......@@ -55,7 +55,7 @@ int main()
### A
```cpp
```c
long pow_2(int b)
{
long x = 2;
......@@ -84,7 +84,7 @@ int main()
### B
```cpp
```c
int gcd(int a, int b)
{
return a % b ? gcd(b, a % b) : b;
......@@ -101,7 +101,7 @@ int main()
### C
```cpp
```c
int gcd(int a, int b)
{
while (b > 0)
......
......@@ -50,20 +50,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int n;
......@@ -91,7 +91,7 @@ int main()
### A
```cpp
```c
int main()
{
int n, max = 0, min = 0;
......@@ -126,7 +126,7 @@ int main()
### B
```cpp
```c
int n;
int Max(int m[10005])
......@@ -183,7 +183,7 @@ int main()
### C
```cpp
```c
int main()
{
int n;
......
......@@ -22,20 +22,20 @@ x星的国王有个怪癖,他只喜欢数字3,5和7。
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
typedef long long LL;
const LL MAX = 59084709587505;
int main()
......@@ -65,7 +65,7 @@ int main()
### A
```cpp
```c
#define LL long long
LL maxs = 59084709587505;
set<LL> q;
......@@ -98,7 +98,7 @@ int main()
### B
```cpp
```c
typedef long long LL;
const LL Max = 59084709587505;
int a[3] = {3, 5, 7};
......@@ -132,7 +132,7 @@ int main(void)
### C
```cpp
```c
int main()
{
set<long long> st;
......
......@@ -21,20 +21,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
const int N = 10010;
int k;
......@@ -77,7 +77,7 @@ int main()
### A
```cpp
```c
typedef long long ll;
const ll maxn = 1e6 + 50;
ll a[maxn];
......@@ -129,7 +129,7 @@ int main()
### B
```cpp
```c
const int N = 10001;
int prime[N]{0};
......@@ -184,7 +184,7 @@ int main()
### C
```cpp
```c
typedef long long LL;
set<int> all;
......
......@@ -63,20 +63,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
#define ll long long
#define inf 0x7fffffff
const int N = 1e5 + 10;
......@@ -127,7 +127,7 @@ int main()
### A
```cpp
```c
#define mem(a, b) memset(a, b, sizeof(a))
#define mod 1000000009
......@@ -292,7 +292,7 @@ int main()
### B
```cpp
```c
#define mod 1000000009
const int N = 100010;
typedef long long LL;
......@@ -365,7 +365,7 @@ int main()
### C
```cpp
```c
int main()
{
int n, k;
......
......@@ -66,20 +66,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int a[100000];
int main()
{
......@@ -112,7 +112,7 @@ int main()
### A
```cpp
```c
int convert(string s)
{
stringstream str;
......@@ -159,7 +159,7 @@ int main()
### B
```cpp
```c
int a[10005];
int main()
{
......@@ -200,7 +200,7 @@ int main()
### C
```cpp
```c
int ans[10005];
char str[100001];
......
......@@ -12,20 +12,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int a[2014];
int main()
{
......@@ -58,7 +58,7 @@ int main()
### A
```cpp
```c
int main()
{
string s = "abcdefghijklmnopqrs";
......@@ -83,7 +83,7 @@ int main()
### B
```cpp
```c
int main()
{
char a[2015];
......@@ -108,7 +108,7 @@ int main()
### C
```cpp
```c
int main()
{
vector<char> vc1;
......
......@@ -29,7 +29,7 @@ yx1
请从以下四个选项中选择空白处的内容。
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -66,19 +66,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
if (min > sum)
{
min = sum;
......@@ -95,7 +95,7 @@ int main()
### A
```cpp
```c
if (min < sum)
{
min = sum;
......@@ -110,7 +110,7 @@ int main()
### B
```cpp
```c
if (min > sum)
{
max = sum;
......@@ -125,7 +125,7 @@ int main()
### C
```cpp
```c
if (min > sum)
{
min = sum;
......
......@@ -55,20 +55,20 @@ bbccccddaaaacccc
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
const int N = 1010;
int cnt[26];
char a[N];
......@@ -100,7 +100,7 @@ int main()
### A
```cpp
```c
int main()
{
char s[1000];
......@@ -130,7 +130,7 @@ int main()
### B
```cpp
```c
int cnt[1001];
int main()
{
......@@ -165,7 +165,7 @@ int main()
### C
```cpp
```c
int a[26];
int main()
......
......@@ -17,19 +17,19 @@ X出生后每隔3分钟分裂一次(数目加倍),Y出生后每隔2分钟
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
94371840
```
......@@ -37,18 +37,18 @@ X出生后每隔3分钟分裂一次(数目加倍),Y出生后每隔2分钟
### A
```cpp
```c
167772160
```
### B
```cpp
```c
47185920
```
### C
```cpp
```c
92160
```
......@@ -21,20 +21,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int count2 = 0, count5 = 0;
......@@ -63,7 +63,7 @@ int main()
### A
```cpp
```c
int main()
{
......@@ -86,7 +86,7 @@ int main()
### B
```cpp
```c
int a[] = {5650, 4542, 3554, 473, 946, 4114, 3871, 9073, 90, 4329,
2758, 7949, 6113, 5659, 5245, 7432, 3051, 4434, 6704, 3594,
9937, 1173, 6866, 3397, 4759, 7557, 3070, 2287, 1453, 9899,
......@@ -115,7 +115,7 @@ int main()
### C
```cpp
```c
int main()
{
int t_cnt, f_cnt, data = 0;
......
......@@ -13,19 +13,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
2017-08-05
```
......@@ -33,18 +33,18 @@
### A
```cpp
```c
2017-09-05
```
### B
```cpp
```c
2017-08-06
```
### C
```cpp
```c
2017-09-06
```
......@@ -11,19 +11,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
761
```
......@@ -31,18 +31,18 @@
### A
```cpp
```c
759
```
### B
```cpp
```c
760
```
### C
```cpp
```c
769
```
......@@ -13,19 +13,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
3880
```
......@@ -33,18 +33,18 @@
### A
```cpp
```c
3400
```
### B
```cpp
```c
3920
```
### C
```cpp
```c
3900
```
......@@ -34,7 +34,7 @@
以下代码实现了这一功能,请你填补空白处的内容:
```cpp
```c
#include <iostream>
using namespace std;
......@@ -74,19 +74,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
n /= 10;
```
......@@ -94,18 +94,18 @@ int main()
### A
```cpp
```c
n %= 10;
```
### B
```cpp
```c
break;
```
### C
```cpp
```c
continue;
```
......@@ -12,19 +12,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
1025
```
......@@ -32,18 +32,18 @@
### A
```cpp
```c
1024
```
### B
```cpp
```c
512
```
### C
```cpp
```c
513
```
......@@ -60,7 +60,7 @@ ts id
下面的程序实现了这一功能,请你补全空白处的内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -101,19 +101,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
cnt[logs[j].y]--, j++;
```
......@@ -121,18 +121,18 @@ cnt[logs[j].y]--, j++;
### A
```cpp
```c
cnt[logs[j].y]--; j++;
```
### B
```cpp
```c
cnt[logs[j].y]++, j++;
```
### C
```cpp
```c
cnt[logs[j].y]++; j++;
```
......@@ -20,19 +20,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int vis[10];
int ans = 0;
bool s(int i)
......@@ -90,7 +90,7 @@ int main()
### A
```cpp
```c
bool isOk(int result, int t1, int t2)
{
bool flag1[10] = {0}, flag2[10] = {0};
......@@ -150,7 +150,7 @@ int main()
### B
```cpp
```c
int main()
{
int v[5], i;
......@@ -191,7 +191,7 @@ int main()
### C
```cpp
```c
#define MAX_N 1005
bool judge1(int n)
......
......@@ -6,19 +6,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
5217
```
......@@ -26,18 +26,18 @@
### A
```cpp
```c
5218
```
### B
```cpp
```c
5216
```
### C
```cpp
```c
5210
```
......@@ -8,19 +8,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
26
```
......@@ -28,18 +28,18 @@
### A
```cpp
```c
24
```
### B
```cpp
```c
25
```
### C
```cpp
```c
27
```
......@@ -11,19 +11,19 @@ A 国估计被测的民众的感染率大概是 1%,呈均匀分布。请问 k
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
10
```
......@@ -31,18 +31,18 @@ A 国估计被测的民众的感染率大概是 1%,呈均匀分布。请问 k
### A
```cpp
```c
8
```
### B
```cpp
```c
9
```
### C
```cpp
```c
12
```
......@@ -10,7 +10,7 @@
请填补空白处的内容。
```cpp
```c
#include <stdio.h>
int main()
{
......@@ -30,19 +30,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
i % 2 == 0
```
## 选项
......@@ -50,18 +50,18 @@ i % 2 == 0
### A
```cpp
```c
i % 2 == 1
```
### B
```cpp
```c
i / 2 == 0
```
### C
```cpp
```c
i / 2 == 1
```
......@@ -36,7 +36,7 @@
以下程序实现了该功能,请你补全空白处代码:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -65,19 +65,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
sum[i] = (sum[i - 1] + son[i]) % k;
```
......@@ -85,18 +85,18 @@ sum[i] = (sum[i - 1] + son[i]) % k;
### A
```cpp
```c
sum[i] = (sum[i] + son[i]) % k;
```
### B
```cpp
```c
sum[i] = (sum[i - 1] + son[i]) % k - 1;
```
### C
```cpp
```c
sum[i] = (sum[i - 1] + son[i - 1]) % k;
```
......@@ -19,19 +19,19 @@ A,2,3,4,5,6,7,8,9 共9张纸牌排成一个正三角形(A按1计算)。要
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
144
```
......@@ -39,18 +39,18 @@ A,2,3,4,5,6,7,8,9 共9张纸牌排成一个正三角形(A按1计算)。要
### A
```cpp
```c
124
```
### B
```cpp
```c
128
```
### C
```cpp
```c
132
```
......@@ -57,20 +57,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int search(int i);
int n;
int a[10000] = {0};
......@@ -121,7 +121,7 @@ int search(int i)
### A
```cpp
```c
int main()
{
int n, a[10005];
......@@ -144,7 +144,7 @@ int main()
### B
```cpp
```c
int main()
{
int n;
......@@ -175,7 +175,7 @@ int main()
### C
```cpp
```c
int main()
{
int n;
......
......@@ -19,19 +19,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
639172
```
......@@ -39,18 +39,18 @@
### A
```cpp
```c
629173
```
### B
```cpp
```c
691372
```
### C
```cpp
```c
627193
```
......@@ -1026,19 +1026,19 @@ REPEAT 9:
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
403
```
......@@ -1046,18 +1046,18 @@ REPEAT 9:
### A
```cpp
```c
400
```
### B
```cpp
```c
401
```
### C
```cpp
```c
402
```
......@@ -18,19 +18,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
171700
```
......@@ -38,18 +38,18 @@
### A
```cpp
```c
166650
```
### B
```cpp
```c
176851
```
### C
```cpp
```c
182104
```
......@@ -13,19 +13,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
624
```
......@@ -33,18 +33,18 @@
### A
```cpp
```c
626
```
### B
```cpp
```c
622
```
### C
```cpp
```c
628
```
......@@ -37,7 +37,7 @@
以下程序实现了这一功能,请你补全空白处的内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -84,19 +84,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
p.first = (s[j][1] - s[i][1]) / (s[i][0] - s[j][0]);
```
......@@ -104,18 +104,18 @@ p.first = (s[j][1] - s[i][1]) / (s[i][0] - s[j][0]);
### A
```cpp
```c
p.first = (s[j][1] - s[i][1]) / (s[i][1] - s[j][1]);
```
### B
```cpp
```c
p.first = (s[j][0] - s[i][0]) / (s[i][0] - s[j][0]);
```
### C
```cpp
```c
p.first = (s[j][0] - s[i][0]) / (s[i][1] - s[j][1]);
```
......@@ -30,7 +30,7 @@
请你填补空白处的内容:
```cpp
```c
#include <stdio.h>
void f(int x)
......@@ -57,19 +57,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
x = x & (x + 1);
```
......@@ -77,18 +77,18 @@ x = x & (x + 1);
### A
```cpp
```c
x = x & (x - 1);
```
### B
```cpp
```c
x = x && (x - 1);
```
### C
```cpp
```c
x = x && (x + 1);
```
......@@ -66,7 +66,7 @@
以下程序实现了这一功能,请你补全空白处内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -122,19 +122,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int mid = l + r >> 1;
```
......@@ -142,18 +142,18 @@ int mid = l + r >> 1;
### A
```cpp
```c
int mid = l + (r >> 1);
```
### B
```cpp
```c
int mid = l + r;
```
### C
```cpp
```c
int mid = l + r + 1;
```
......@@ -55,20 +55,20 @@ C = [C1, C2, ... CN],
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int n;
......@@ -120,7 +120,7 @@ int main()
### A
```cpp
```c
const int maxn = 1e5 + 10;
typedef long long ll;
int a[maxn];
......@@ -156,7 +156,7 @@ int main()
### B
```cpp
```c
#define ll long long
using namespace std;
......@@ -224,7 +224,7 @@ int main()
### C
```cpp
```c
typedef long long LL;
const int N = 1e5 + 10;
......
......@@ -13,19 +13,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
1499441040
```
......@@ -33,18 +33,18 @@
### A
```cpp
```c
1949990009
```
### B
```cpp
```c
914140441
```
### C
```cpp
```c
1101001
```
......@@ -8,19 +8,19 @@ y年m月d日是哪一年的第几天。
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
189
```
## 选项
......@@ -28,18 +28,18 @@ y年m月d日是哪一年的第几天。
### A
```cpp
```c
188
```
### B
```cpp
```c
190
```
### C
```cpp
```c
191
```
......@@ -36,7 +36,7 @@
请从以下四个选项中选择正确的代码填补空白处,实现方阵转置功能。
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -64,19 +64,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
......@@ -91,7 +91,7 @@ int main()
### A
```cpp
```c
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
......@@ -104,7 +104,7 @@ int main()
### B
```cpp
```c
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
......@@ -117,7 +117,7 @@ int main()
### C
```cpp
```c
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
......
......@@ -7,7 +7,7 @@
请从以下四个选项中选择正确答案,填补在空白处,使得代码能运行后能产生正确的结果。
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -51,19 +51,19 @@ int main(int argc, char *argv[])
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
n2 / base + n3 / base + n4 % base
```
## 选项
......@@ -71,18 +71,18 @@ n2 / base + n3 / base + n4 % base
### A
```cpp
```c
n2 % base + n3 / base + n4 / base
```
### B
```cpp
```c
n2 / base + n3 % base + n4 / base
```
### C
```cpp
```c
n2 / base + n3 / base + n4 / base
```
......@@ -24,20 +24,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int bei[10];
map<long long, int> mp;
......@@ -95,7 +95,7 @@ int main()
### A
```cpp
```c
const int N = 1e3 + 5;
int a[15] = {9, 2, 1, 3, 8, 5, 6, 7, 4}, res = 0, vis[12], temp1;
bool fun(int x)
......@@ -151,7 +151,7 @@ int main()
### B
```cpp
```c
int st[10], res[10], book[10], cnt;
int cal(int l, int r)
......@@ -218,7 +218,7 @@ int main()
### C
```cpp
```c
typedef long long LL;
const int N = 15;
bool vis[N];
......
......@@ -21,20 +21,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int d, a1[4];
int d1(int *a1)
......@@ -87,7 +87,7 @@ int main()
### A
```cpp
```c
int main()
{
float n;
......@@ -113,7 +113,7 @@ int main()
### B
```cpp
```c
int cm(int a, int b)
{
int temp;
......@@ -159,7 +159,7 @@ int main()
### C
```cpp
```c
int main(void)
{
float a, b, c, d;
......
......@@ -51,20 +51,20 @@ o 6
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
char a[1005];
......@@ -95,7 +95,7 @@ int main()
### A
```cpp
```c
#define MAX 1010
int s[MAX];
......@@ -138,7 +138,7 @@ int main()
### B
```cpp
```c
char m[1005];
int n[1005];
char c;
......@@ -198,7 +198,7 @@ int main()
### C
```cpp
```c
int main()
{
int a[128] = {0};
......
......@@ -46,19 +46,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
0.6180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911375
```
......@@ -66,18 +66,18 @@
### A
```cpp
```c
0.6180339887498948482045868343656389332927878467731611281824609112882717278172075687340936512886003869
```
### B
```cpp
```c
0.6180339887498948482045868343656381177203091798057628621354486227052604628189024496923340122463725713
```
### C
```cpp
```c
0.6180339887498948482045868343656382367107301981874040757690591496236273680999331990382076023866480180
```
......@@ -130,19 +130,19 @@ WSDAUGUTVWCVHEMOIRJJGTANUWTSAIXXEVZTBDHPGSRHHVWCDZVZYRJTLONIJVXEATHQXOUKBIGZONFR
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
41
```
......@@ -150,18 +150,18 @@ WSDAUGUTVWCVHEMOIRJJGTANUWTSAIXXEVZTBDHPGSRHHVWCDZVZYRJTLONIJVXEATHQXOUKBIGZONFR
### A
```cpp
```c
38
```
### B
```cpp
```c
39
```
### C
```cpp
```c
40
```
......@@ -47,7 +47,7 @@ LCXYZ
以下程序实现了这一功能,请你补全空白处内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -81,19 +81,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
re = re + char(temp + 'A' - 1);
i += 2;
```
......@@ -102,21 +102,21 @@ i += 2;
### A
```cpp
```c
re = re + char(temp + 'A' - 1);
i += 1;
```
### B
```cpp
```c
re = re + char(temp + 'A');
i += 1;
```
### C
```cpp
```c
re = re + char(temp + 'A');
i += 2;
```
......@@ -54,20 +54,20 @@ o****o****
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
char a[1005], b[1005];
int len, i = 0, ans = 0;
......@@ -92,7 +92,7 @@ int main()
### A
```cpp
```c
char a[1005], b[1005];
struct node
......@@ -156,7 +156,7 @@ int main()
### B
```cpp
```c
int main()
{
string a;
......@@ -194,7 +194,7 @@ int main()
### C
```cpp
```c
int main()
{
string a, b;
......
......@@ -33,7 +33,7 @@
请您补全以下代码:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -58,19 +58,19 @@ int main(int argc, char **argv)
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
if (str[i] <= '9' && str[i] >= '0')
{
number++;
......@@ -89,7 +89,7 @@ int main(int argc, char **argv)
### A
```cpp
```c
if ('0' <= str[i] <= '0')
{
number++;
......@@ -106,7 +106,7 @@ int main(int argc, char **argv)
### B
```cpp
```c
if (str[i] <= '9' & str[i] >= '0')
{
number++;
......@@ -123,7 +123,7 @@ int main(int argc, char **argv)
### C
```cpp
```c
if (str[i] < '9' && str[i] > '0')
{
number++;
......
......@@ -57,20 +57,20 @@ This is a story about Alice and Bob. Alice wants to send a private message to Bo
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int k;
......@@ -143,7 +143,7 @@ int main()
### A
```cpp
```c
int cnt, k;
bool temp = true;
char f[2][20] = {"Alice", "Bob"};
......@@ -187,7 +187,7 @@ int main()
### B
```cpp
```c
#define mem(a, b) memset(a, b, sizeof a)
#define PII pair<int, int>
#define ll long long
......@@ -261,7 +261,7 @@ int main()
### C
```cpp
```c
int len;
string s;
bool check(int i)
......
......@@ -36,7 +36,7 @@ HHHellllloo
以下程序实现了这一功能,请你填补空白处内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -73,19 +73,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
s2[top++] = s1[i - 1];
```
......@@ -93,18 +93,18 @@ s2[top++] = s1[i - 1];
### A
```cpp
```c
s2[++top] = s1[i - 1];
```
### B
```cpp
```c
s2[++top] = s1[i + 1];
```
### C
```cpp
```c
s2[top++] = s1[i + 1];
```
......@@ -12,7 +12,7 @@
以下程序实现了这一功能,请你补全空白处的内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -33,19 +33,19 @@ int main()
## aop
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
s.insert(str.substr(i, j - i + 1));
```
......@@ -53,18 +53,18 @@ s.insert(str.substr(i, j - i + 1));
### A
```cpp
```c
s.insert(str.substr(i, j + i + 1));
```
### B
```cpp
```c
s.insert(str.substr(i, j - i - 1));
```
### C
```cpp
```c
s.insert(str.substr(i, j - i));
```
......@@ -46,19 +46,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
#define MAX 110
#define INF 0x3f3f3f3f
#define EXP 1e-9
......@@ -198,7 +198,7 @@ int main()
### A
```cpp
```c
const int inf = 0x3fffffff;
const int maxn = 100100;
......@@ -337,7 +337,7 @@ int main()
### B
```cpp
```c
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int data[8];
void guizheng()
......@@ -418,7 +418,7 @@ int main()
### C
```cpp
```c
int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool check(int year)
......
......@@ -8,7 +8,7 @@ StringInGrid函数会在一个指定大小的格子中打印指定的字符串
以下程序实现了这一功能,请你补全空白处内容:
```cpp
```c
#include <stdio.h>
#include <string.h>
void StringInGrid(int width, int height, const char *s)
......@@ -56,19 +56,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
(width - strlen(buf) - 2) / 2, "", buf, (width - strlen(buf) - 2) / 2, ""
```
......@@ -76,18 +76,18 @@ int main()
### A
```cpp
```c
(width - strlen(buf) - 1) / 2, "", buf, (width - strlen(buf) - 1) / 2, ""
```
### B
```cpp
```c
(width - strlen(buf) + 1) / 2, "", buf, (width - strlen(buf) + 1) / 2, ""
```
### C
```cpp
```c
(width - strlen(buf) - 2), "", buf, (width - strlen(buf) - 2), ""
```
......@@ -12,7 +12,7 @@
请你补全空白处的内容:
```cpp
```c
#include <stdio.h>
#include <string.h>
......@@ -52,19 +52,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
a[i][j] = a[i - 1][j - 1] + 1;
```
......@@ -72,18 +72,18 @@ a[i][j] = a[i - 1][j - 1] + 1;
### A
```cpp
```c
a[i][j] = a[i - 1][j - 1];
```
### B
```cpp
```c
a[i][j] = a[i - 1][j] + 1;
```
### C
```cpp
```c
a[i][j] = a[i][j - 1] + 1;
```
......@@ -50,7 +50,7 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -58,13 +58,13 @@ using namespace std;
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int n, ans = 0;
......@@ -99,7 +99,7 @@ int main()
### A
```cpp
```c
int visit[10] = {0};
int s[10];
int ans = 0;
......@@ -159,7 +159,7 @@ int main()
### B
```cpp
```c
int parse(const char *arr, int pos, int len)
{
int ans = 0;
......@@ -209,7 +209,7 @@ int main()
### C
```cpp
```c
int a[10] = {0};
int Division(int m)
{
......
......@@ -18,7 +18,7 @@ C国最多可以派出2人。
请你补全代码中空白的部分:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -59,19 +59,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
f(a, k + 1, m - i, b);
```
## 选项
......@@ -79,18 +79,18 @@ f(a, k + 1, m - i, b);
### A
```cpp
```c
f(a, k, m - i, b);
```
### B
```cpp
```c
f(a, k - 1, m - i, b);
```
### C
```cpp
```c
f(a, k + 1, m + i, b);
```
......@@ -62,7 +62,7 @@ ran=6
请你补全程序,实现该图形的打印。
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -109,19 +109,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
f(a, rank - 1, row, col + w / 2);
```
## 选项
......@@ -129,18 +129,18 @@ f(a, rank - 1, row, col + w / 2);
### A
```cpp
```c
f(a, rank, row, col + w / 2);
```
### B
```cpp
```c
f(a, rank - 1, row, col + w);
```
### C
```cpp
```c
f(a, rank + 1, row, col + w / 2);
```
......@@ -37,7 +37,7 @@
下面的代码实现了这一功能,请你补全代码中的空白处:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -75,19 +75,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
return b ? gcd(b, a % b) : a;
```
## 选项
......@@ -95,18 +95,18 @@ return b ? gcd(b, a % b) : a;
### A
```cpp
```c
return b ? gcd(b, a) : a;
```
### B
```cpp
```c
return b ? gcd(b, a / b) : a;
```
### C
```cpp
```c
return b ? gcd(b, a + b) : a;
```
......@@ -50,20 +50,20 @@ Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int fib(int n)
{
if (n < 3)
......@@ -84,7 +84,7 @@ int main()
### A
```cpp
```c
int fib(int N)
{
if (N <= 0)
......@@ -113,7 +113,7 @@ int main()
### B
```cpp
```c
int main()
{
int n, b;
......@@ -136,7 +136,7 @@ int main()
### C
```cpp
```c
int f[1000000 + 1];
void meter(int n)
......
......@@ -4,7 +4,7 @@
以下的方法就是一种。请你填补空白处的内容:
```cpp
```c
#include <stdio.h>
int len(int x)
{
......@@ -33,19 +33,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
return f(x / 10, k);
```
......@@ -53,18 +53,18 @@ int main()
### A
```cpp
```c
return f(x % 10, k);
```
### B
```cpp
```c
return f(x, k);
```
### C
```cpp
```c
return f(x, k / 10);
```
......@@ -26,7 +26,7 @@
请你补全代码:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -79,19 +79,19 @@ int main(int argc, char **argv)
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
v2 = evaluate(x + v1.n + 1);
```
......@@ -99,18 +99,18 @@ v2 = evaluate(x + v1.n + 1);
### A
```cpp
```c
v2 = evaluate(x + v1.n);
```
### B
```cpp
```c
v2 = evaluate(v1.n);
```
### C
```cpp
```c
v2 = evaluate(v1.n + 1);
```
......@@ -10,7 +10,7 @@ A A 2 2 3 3 4 4, 一共4对扑克牌。请你把它们排成一行。
以下程序实现了这一功能,请你补全空白处内容:
```cpp
```c
#include <iostream>
using namespace std;
int n = 0;
......@@ -62,19 +62,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
pailie(str, k + 1, m);
```
......@@ -82,18 +82,18 @@ pailie(str, k + 1, m);
### A
```cpp
```c
pailie(str, k, m);
```
### B
```cpp
```c
pailie(str, k - 1, m);
```
### C
```cpp
```c
pailie(str, k + 1, m + 1);
```
......@@ -21,7 +21,7 @@
以下代码实现了这一功能,请你填补空白处内容:
```cpp
```c
#include <iostream>
using namespace std;
......@@ -42,19 +42,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
return f(x + 1, y) + f(x, y + 1);
```
......@@ -62,18 +62,18 @@ return f(x + 1, y) + f(x, y + 1);
### A
```cpp
```c
return f(x - 1, y) + f(x, y - 1);
```
### B
```cpp
```c
return f(x + 1, y) + f(x, y - 1);
```
### C
```cpp
```c
return f(x + 1, y + 1) + f(x + 1, y + 1);
```
......@@ -67,7 +67,7 @@ CPU消耗 < 1000ms
下面的代码实现了这一功能,请你补全空白处缺失的代码:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -128,19 +128,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
dp[i] = (C(s[i] - 1, s[i * 2 + 1]) * dp[i * 2 + 1]) % mod * dp[i * 2] % mod;
```
## 选项
......@@ -148,18 +148,18 @@ dp[i] = (C(s[i] - 1, s[i * 2 + 1]) * dp[i * 2 + 1]) % mod * dp[i * 2] % mod;
### A
```cpp
```c
dp[i] = (C(s[i], s[i * 2 + 1]) * dp[i * 2 + 1]) % mod * dp[i * 2 + 1] % mod;
```
### B
```cpp
```c
dp[i] = (C(s[i] - 1, s[i * 2]) * dp[i * 2]) % mod * dp[i * 2] % mod;
```
### C
```cpp
```c
dp[i] = (C(s[i] + 1, s[i * 2 + 1]) * dp[i * 2 + 1]) % mod * dp[i * 2] % mod;
```
......@@ -66,20 +66,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int m, n;
int len = 0;
int main()
......@@ -124,7 +124,7 @@ int main()
### A
```cpp
```c
int main()
{
vector<int> a;
......@@ -171,7 +171,7 @@ int main()
### B
```cpp
```c
int a[500005];
int main()
......@@ -213,7 +213,7 @@ int main()
### C
```cpp
```c
struct num
{
int order;
......
......@@ -14,19 +14,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
1580
```
## 选项
......@@ -34,18 +34,18 @@
### A
```cpp
```c
1579
```
### B
```cpp
```c
1582
```
### C
```cpp
```c
1581
```
......@@ -8,19 +8,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
16
```
## 选项
......@@ -28,18 +28,18 @@
### A
```cpp
```c
17
```
### B
```cpp
```c
18
```
### C
```cpp
```c
19
```
......@@ -10,19 +10,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
8879
```
......@@ -30,18 +30,18 @@
### A
```cpp
```c
8888
```
### B
```cpp
```c
8880
```
### C
```cpp
```c
8808
```
......@@ -60,20 +60,20 @@ n 个小朋友站成一排。
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
#define ll long long
using namespace std;
int const MAX = 1e5 + 5;
......@@ -151,7 +151,7 @@ int main()
### A
```cpp
```c
typedef long long LL;
const int N = 1e6 + 10;
int h[N], s[N], tr[N];
......@@ -197,7 +197,7 @@ int main()
### B
```cpp
```c
struct childInfo
{
int location;
......@@ -280,7 +280,7 @@ int main()
### C
```cpp
```c
struct childInfo
{
int location;
......
......@@ -80,20 +80,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
typedef long long ll;
#define int ll
#define rep(i, a, n) for (int i = a; i < (int)n; i++)
......@@ -168,7 +168,7 @@ signed main()
### A
```cpp
```c
#define ll long long
const int N = 3e5;
ll a[N], s[N];
......@@ -217,7 +217,7 @@ int main()
### B
```cpp
```c
const int MAXN = 300010;
int nums[MAXN];
......@@ -329,7 +329,7 @@ int main()
### C
```cpp
```c
typedef long long LL;
const int INF = 0x3f3f3f3f;
const double Pi = acos(-1);
......
......@@ -69,7 +69,7 @@ a5: 2出现过,最后一次为原序列的a3,在a3后、a5前有1种数字
以下程序实现了这一功能,请你补全空白处的内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -143,19 +143,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
query(a, b, (k << 1) + 1, l, mid) + query(a, b, (k + 1) << 1, mid, r)
```
......@@ -163,18 +163,18 @@ query(a, b, (k << 1) + 1, l, mid) + query(a, b, (k + 1) << 1, mid, r)
### A
```cpp
```c
query(a, b, (k >> 1) + 1, l, mid) + query(a, b, (k + 1) >> 1, mid, r)
```
### B
```cpp
```c
query(a, b, k << 1, l, mid) + query(a, b, k << 1, mid, r)
```
### C
```cpp
```c
query(a, b, (k << 1) + 1, l, mid) + query(a, b, (k + 1) >> 1, mid, r)
```
......@@ -41,19 +41,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
387420489
```
......@@ -61,18 +61,18 @@
### A
```cpp
```c
10000000000
```
### B
```cpp
```c
16777216
```
### C
```cpp
```c
43046721
```
......@@ -63,7 +63,7 @@
以下程序实现了这一功能,请你补全空白处的内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -166,19 +166,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
bp[get(i, j, k)] += s[get(x, y, z)] * t;
```
......@@ -186,18 +186,18 @@ bp[get(i, j, k)] += s[get(x, y, z)] * t;
### A
```cpp
```c
bp[get(i, j, k)] = s[get(x, y, z)] * t;
```
### B
```cpp
```c
bp[get(i, j, k)] *= s[get(x, y, z)] * t;
```
### C
```cpp
```c
bp[get(i, j, k)] = s[get(x, y, z)] + t;
```
......@@ -72,7 +72,7 @@
以下程序实现了该功能,请你补全空白处内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -160,19 +160,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
if (direction == Dup)
nRow -= 1;
else if (direction == Dright)
......@@ -187,7 +187,7 @@ else
### A
```cpp
```c
if (direction == Dup)
nRow += 1;
else if (direction == Dright)
......@@ -201,7 +201,7 @@ else
### B
```cpp
```c
if (direction == Dup)
nRow += 1;
else if (direction == Dright)
......@@ -214,7 +214,7 @@ else
### C
```cpp
```c
if (direction == Dup)
nRow -= 1;
else if (direction == Dright)
......
......@@ -39,7 +39,7 @@ X和Y
以下程序实现了该功能,请你补全空白处内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -69,19 +69,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
sum += (long long)y > 0 ? (2 * y + y + x) : (6 * y - y - x);
```
......@@ -89,18 +89,18 @@ sum += (long long)y > 0 ? (2 * y + y + x) : (6 * y - y - x);
### A
```cpp
```c
sum += (long long)y > 0 ? (2 * y + x) : (6 * y - y - x);
```
### B
```cpp
```c
sum += (long long)y > 0 ? (2 * y + y + x) : (6 * y - x);
```
### C
```cpp
```c
sum += (long long)y > 0 ? (2 * y + x) : (6 * y - x);
```
......@@ -52,19 +52,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
string s;
void init()
{
......@@ -122,7 +122,7 @@ int main()
### A
```cpp
```c
int main()
{
int n;
......@@ -271,7 +271,7 @@ int main()
### B
```cpp
```c
int a[3005], n;
char m[1300][1300];
void init()
......@@ -345,7 +345,7 @@ int main()
### C
```cpp
```c
string str;
stringstream ss;
......
......@@ -58,7 +58,7 @@ X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
以下的代码可以计算出点子称的示数,请你补全它:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -97,19 +97,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
a[i + 1][j + 1] += (0.5 * a[i][j]);
```
## 选项
......@@ -117,18 +117,18 @@ a[i + 1][j + 1] += (0.5 * a[i][j]);
### A
```cpp
```c
a[i + 1][j] += (0.5 * a[i][j]);
```
### B
```cpp
```c
a[i][j + 1] += (0.5 * a[i][j]);
```
### C
```cpp
```c
a[i + 1][j + 1] = (0.5 * a[i][j]);
```
......@@ -46,20 +46,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
bool cmp(pair<int, int> a, pair<int, int> b)
{
return a.first > b.first;
......@@ -106,7 +106,7 @@ int main()
### A
```cpp
```c
int main()
{
int n, k;
......@@ -138,7 +138,7 @@ int main()
### B
```cpp
```c
typedef struct
{
int h, w;
......@@ -192,7 +192,7 @@ int main()
### C
```cpp
```c
int co[100100][2];
int coun(int n, int x)
......
......@@ -24,20 +24,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int num1[7] = {0, 1, 2, 5, 6, 8, 9};
......@@ -97,7 +97,7 @@ int main()
### A
```cpp
```c
void i2s(int num, string &str)
{
stringstream ss;
......@@ -179,7 +179,7 @@ int main()
### B
```cpp
```c
#define ll long long
using namespace std;
int flag(int n)
......@@ -236,7 +236,7 @@ int main()
### C
```cpp
```c
int num[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int dnum[] = {0, 1, 2, -1, -1, 5, 9, -1, 8, 6};
int main()
......
......@@ -35,7 +35,7 @@
以下程序可以实现该功能,请你计算该程序的算法复杂度:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -74,19 +74,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
O(n^1.5)
```
## 选项
......@@ -94,18 +94,18 @@ O(n^1.5)
### A
```cpp
```c
O(n^3)
```
### B
```cpp
```c
O(n^2)
```
### C
```cpp
```c
O(n^2.5)
```
......@@ -26,19 +26,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
80
```
## 选项
......@@ -46,18 +46,18 @@
### A
```cpp
```c
90
```
### B
```cpp
```c
70
```
### C
```cpp
```c
78
```
......@@ -41,20 +41,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int n;
......@@ -95,7 +95,7 @@ int main()
### A
```cpp
```c
int main()
{
int n, m, count = 0, t = 0;
......@@ -144,7 +144,7 @@ int main()
### B
```cpp
```c
int n;
int a[100];
int main()
......@@ -201,7 +201,7 @@ int main()
### C
```cpp
```c
int main()
{
int n;
......
......@@ -26,20 +26,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
float a[4][4] = {0, 0.1, 0.3, 0.5, 0.9, 0, 0.7, 0.4, 0.7, 0.3, 0, 0.2, 0.5, 0.6, 0.8, 0};
......@@ -66,7 +66,7 @@ int main()
### A
```cpp
```c
int main()
{
int i, j;
......@@ -92,7 +92,7 @@ int main()
### B
```cpp
```c
double p[3];
int main()
{
......@@ -116,7 +116,7 @@ int main()
### C
```cpp
```c
double rate[4][4] = {
{0, 0.1, 0.3, 0.5},
{0.9, 0, 0.7, 0.4},
......
......@@ -54,20 +54,20 @@ J大臣想知道:他从某一个城市出发,中间不休息,到达另一
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
struct edge
{
int to, cost;
......@@ -116,7 +116,7 @@ int main()
### A
```cpp
```c
const int maxd = 10000 + 50;
struct Point
......@@ -166,7 +166,7 @@ int main()
### B
```cpp
```c
#define _for(i, a, b) for (int i = a; i < b; i++)
#define _unfor(i, a, b) for (int i = a; i >= b; i--)
#define RI(a) scanf("%d", &a)
......@@ -239,7 +239,7 @@ int main()
### C
```cpp
```c
#define mem(a, b) memset(a, b, sizeof(a))
#define ll long long
const double eps = 3e-8;
......
......@@ -18,20 +18,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
const int MAXN = 1e7;
int arr[9] = {4, 3, 2, 1, 0, 8, 7, 6, 5};
......@@ -120,7 +120,7 @@ int main()
### A
```cpp
```c
string start = "012345678";
string e = "087654321";
int main()
......@@ -165,7 +165,7 @@ int main()
### B
```cpp
```c
struct node
{
string str;
......@@ -216,7 +216,7 @@ int main()
### C
```cpp
```c
int dir[] = {1, -1, 2, -2};
unordered_map<string, int> dist;
string S = "12345678X", T = "87654321X";
......
......@@ -67,20 +67,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int n = 0;
......@@ -179,7 +179,7 @@ int main()
### A
```cpp
```c
int const N = 10010;
using namespace std;
int n, m;
......@@ -263,7 +263,7 @@ int main()
### B
```cpp
```c
const int N = 10010;
int p[N], d[N];
int find(int x)
......@@ -312,7 +312,7 @@ int main()
### C
```cpp
```c
const int maxn = 10005;
int a[maxn][maxn];
int dfs_vis[maxn];
......
......@@ -40,20 +40,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
long long n, s, a, b;
long long sum;
long long cnt = 0;
......@@ -100,7 +100,7 @@ int main(void)
### A
```cpp
```c
#define MAXN 1100
#define MOD 100000007
using namespace std;
......@@ -147,7 +147,7 @@ int main()
### B
```cpp
```c
int n, s, a, b;
int num;
......@@ -185,7 +185,7 @@ int main()
### C
```cpp
```c
const int MAXN = 1050;
typedef long long ll;
......
......@@ -59,7 +59,7 @@ jihgfeeddccbbaa
下面的程序实现了这一功能,请你补全空白处内容:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
......@@ -166,19 +166,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
dfs2(pre + len, x - 1, aft - len, rest, res);
```
......@@ -186,18 +186,18 @@ dfs2(pre + len, x - 1, aft - len, rest, res);
### A
```cpp
```c
dfs2(pre + len, x, aft - len, rest, res);
```
### B
```cpp
```c
dfs2(pre + len, x - 1, aft - 1, rest, res);
```
### C
```cpp
```c
dfs2(pre + len, x - 1, aft, rest, res);
```
......@@ -23,19 +23,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
509
```
## 选项
......@@ -43,18 +43,18 @@
### A
```cpp
```c
508
```
### B
```cpp
```c
510
```
### C
```cpp
```c
600
```
......@@ -21,19 +21,19 @@ A + —- + ——–- = 10
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
29
```
## 选项
......@@ -41,18 +41,18 @@ A + —- + ——–- = 10
### A
```cpp
```c
28
```
### B
```cpp
```c
30
```
### C
```cpp
```c
31
```
......@@ -14,7 +14,7 @@ masks = [9090400, 8499400, 5926800, 8547000, 4958200, 4422600, 5751200, 4175600,
下面的代码实现了这一功能,请你填补空白处的内容。
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -50,19 +50,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
dfs(u + 1, s1, s2 + num[u]);
```
## 选项
......@@ -70,18 +70,18 @@ int main()
### A
```cpp
```c
dfs(u, s1, s2 + num[u]);
```
### B
```cpp
```c
dfs(u + 1, s1 + num[u], s2 + num[u]);
```
### C
```cpp
```c
dfs(u + 1, s1 + num[u], s2);
```
......@@ -32,19 +32,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
768
```
## 选项
......@@ -52,18 +52,18 @@
### A
```cpp
```c
767
```
### B
```cpp
```c
769
```
### C
```cpp
```c
770
```
......@@ -26,7 +26,7 @@
下面的代码实现了这一功能,请你补全空白处。
```cpp
```c
const int maxn = 100005;
int numv[maxn];
......@@ -69,19 +69,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
a = (v[idx] * v[idx - 1] + dfs(idx - 2) + numv[idx - 2] * (v[idx] + v[idx - 1]));
```
## 选项
......@@ -89,18 +89,18 @@ a = (v[idx] * v[idx - 1] + dfs(idx - 2) + numv[idx - 2] * (v[idx] + v[idx - 1]))
### A
```cpp
```c
a = (v[idx] * v[idx - 1] + dfs(idx - 2));
```
### B
```cpp
```c
a = (dfs(idx - 2) + numv[idx - 2] * (v[idx] + v[idx - 1]));
```
### C
```cpp
```c
a = (v[idx] * v[idx - 1] + dfs(idx - 1) + numv[idx + 2] * (v[idx] + v[idx - 1]));
```
......@@ -15,20 +15,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int ans = 0;
int sum = 0;
vector<int> a(40, 0);
......@@ -63,7 +63,7 @@ int main()
### A
```cpp
```c
int ans = 0;
void dfs(int k, int n)
{
......@@ -88,7 +88,7 @@ int main()
### B
```cpp
```c
int countt = 0;
void f(int stair, int step)
......@@ -116,7 +116,7 @@ int main(void)
### C
```cpp
```c
#define LEFT 0
#define RIGHT 1
using namespace std;
......
......@@ -18,19 +18,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
int main()
{
int a[15] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2};
......@@ -68,7 +68,7 @@ int main()
### A
```cpp
```c
int res = 0;
void f(int dian, int hua, int jiu)
......@@ -94,7 +94,7 @@ int main(int argc, char **argv)
### B
```cpp
```c
int main()
{
int ans = 0;
......@@ -127,7 +127,7 @@ int main()
### C
```cpp
```c
int cnt;
void dfs(int a, int b, int sum, int u, int flag)
......
......@@ -51,7 +51,7 @@
下面的程序实现了这一功能,请你补全空白处:
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
......@@ -123,19 +123,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
dfs(tx, ty, step + 1);
```
......@@ -143,18 +143,18 @@ int main()
### A
```cpp
```c
dfs(tx, ty, step);
```
### B
```cpp
```c
dfs(tx + 1, ty + 1, step + 1);
```
### C
```cpp
```c
dfs(tx - 1, ty - 1, step + 1);
```
......@@ -18,7 +18,7 @@ x星球有很多高耸入云的高塔,刚好可以用来做耐摔测试。塔
下面的程序实现了这一功能,请你补全空白处的代码:
```cpp
```c
#include <iostream>
using namespace std;
int num[5][1010] = {0};
......@@ -51,19 +51,19 @@ int main()
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
res = min(res, max(dp(k - 1, i - 1), dp(k, n - i)) + 1);
```
## 选项
......@@ -71,18 +71,18 @@ res = min(res, max(dp(k - 1, i - 1), dp(k, n - i)) + 1);
### A
```cpp
```c
res = min(res, max(dp(k, i - 1), dp(k, n - i)) + 1);
```
### B
```cpp
```c
res = min(res, max(dp(k - 1, i), dp(k, n - i)) + 1);
```
### C
```cpp
```c
res = min(res, max(dp(k - 1, i - n), dp(k, n - i)) + 1);
```
......@@ -66,20 +66,20 @@ X 国王有一个地宫宝库,是 n×m 个格子的矩阵,每个格子放一
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
const int N = 55, M = 15, mod = 1e9 + 7;
int w[N][N];
......@@ -136,7 +136,7 @@ int main()
### A
```cpp
```c
int n, m, k;
int data[55][55];
typedef long long LL;
......@@ -230,7 +230,7 @@ int main()
### B
```cpp
```c
int n, m, k;
int data[55][55];
......@@ -284,7 +284,7 @@ int main()
### C
```cpp
```c
const int N = 55;
const int MOD = 1e9 + 7;
int dp[N][N][13][14];
......
......@@ -68,20 +68,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
其他三个都不对
```
......@@ -89,7 +89,7 @@ using namespace std;
### A
```cpp
```c
int main()
{
vector<int> Hole(5);
......@@ -153,7 +153,7 @@ int main()
### B
```cpp
```c
int Solution()
{
int n, sum = 0, L[5] = {0}, m, M, W[5][10] = {0}, le, P, res = 0;
......@@ -224,7 +224,7 @@ int main()
### C
```cpp
```c
constexpr size_t MAXN = 55, MAXS = 305, MAXM = 1e4 + 5;
int n[MAXN], cnt[5], Lv[MAXM], p[MAXM], w[MAXM][MAXN];
int dp[MAXM][MAXS];
......
......@@ -43,20 +43,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
#define ll long long
using namespace std;
......@@ -111,7 +111,7 @@ int main()
### A
```cpp
```c
#define FOR0(a, b) for (int i = a; i < b; ++i)
#define FORE(a, b) for (int i = a; i <= b; ++i)
typedef long long ll;
......@@ -153,7 +153,7 @@ int main()
### B
```cpp
```c
int n, k, ans = 0;
int temp[3], num[100005], vis[100005] = {0};
......@@ -194,7 +194,7 @@ int main()
### C
```cpp
```c
int N, k;
int main()
{
......
......@@ -76,19 +76,19 @@
### before
```cpp
```c
```
### after
```cpp
```c
```
## 答案
```cpp
```c
其他三项都是错的
```
......@@ -96,7 +96,7 @@
### A
```cpp
```c
const int Mod = 1e9 + 7;
int c[2010][2010];
int main()
......@@ -128,7 +128,7 @@ int main()
### B
```cpp
```c
#define modk(x) (((x) >= k) ? ((x)-k) : (x))
const int maxn = 2005;
int c[maxn][maxn], n, m, k, T;
......@@ -181,7 +181,7 @@ int main()
### C
```cpp
```c
const int Mod = 1e9 + 7;
const int inv_2 = 5e8 + 4;
......
......@@ -45,20 +45,20 @@
### before
```cpp
```c
#include <bits/stdc++.h>
using namespace std;
```
### after
```cpp
```c
```
## 答案
```cpp
```c
const int N = 105, M = (1 << 20) + 10;
int n, m, k, x, a[N], dp[M];
......@@ -104,7 +104,7 @@ int main()
### A
```cpp
```c
int n, m, k;
int dp[1 << 20];
vector<int> a;
......@@ -149,7 +149,7 @@ int main()
### B
```cpp
```c
const int maxn = (1 << 20) + 52;
const int inf = 9;
int a[505], n, m, k, dp[2][maxn];
......@@ -204,7 +204,7 @@ int main()
### C
```cpp
```c
int dp[1 << 20];
int ST[100];
int main()
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册