题号 标题 已通过代码 通过率 团队的状态
A Alternating 2.0 点击查看 2/27
B Bustling City 点击查看 24/246
C Cmostp 点击查看 46/296
D Directions 点击查看 2/34
E Everyone is bot 点击查看 832/3213
F Flame blast magician master qcjj 点击查看 18/26
G Good red-string 点击查看 57/1477
H Here is an Easy Problem of Zero-chan 点击查看 1010/2090
I Innocent longing 点击查看 0/11
J Jellyfish and its dream 点击查看 481/2692
K Killer Sajin’s Matrix 点击查看 82/578
L Lndjy and the mex 点击查看 27/59
M Maimai DX 2077 点击查看 1237/1492
链接:https://ac.nowcoder.com/acm/contest/38727/M
来源:牛客网
题目描述
dXqwq likes playing maimai DX UNiVERSE PLUS, since he can’t fly to Japan and SEGA completely ignores the feelings of Chinese players, he can only play maimai DX 2077.
In maimai DX 2077, you need to press the button or touch the screen when NOTE appears. There are 4 types of NOTE: TAP, HOLD, SLIDE, and BREAK. There are also 5 judgments for each NOTE: CRITICAL PERFECT, PERFECT, GREAT, GOOD, and MISS.
For each type of NOTE, you can get some standard points according to the judgment. For BREAK NOTEs, you can get some extra points according to the judgment.
Here is the table of standard points:
Here is the table of extra points:
Let A,BA,B be the standard points and extra points you will have if you get CRITICAL PERFECT on every NOTE, and A_0,B_0A
0
,B
0
be the standard points and extra points you have, the achievement score for this track is defined as \frac{A_0}{A}\cdot100%+\frac{B_0}{B}\cdot1%
A
A
0
⋅100%+
B
B
0
⋅1%.
You are given the number of NOTEs for each type and each judgment, and calculate the achievement score.
输入描述:
There are 44 lines in a test, each line denotes a type of NOTE: TAP, HOLD, SLIDE and BREAK.
The ii-th line contains 55 integers c_{i,0},c_{i,1},\cdots,c_{i,4}c
i,0
,c
i,1
,⋯,c
i,4
(0\leq c_{i,j}\leq 10^30≤c
i,j
≤10
3
), each integer denotes a type of judgment: CRITICAL PERFECT, PERFECT, GREAT, GOOD, and MISS.
It’s guaranteed that there is at least one BREAK note.
输出描述:
Print the percentage of the achievement score in a line. Your answer will be considered correct if the absolute or relative error between yours and the standard answer is no more than 10^{-6}10
−6
. Formally, let your answer be aa and the jury’s answer be bb, and then your answer is considered correct if \frac{|a - b|}{\max(1, |b|)} \leq 10^{-6}
max(1,∣b∣)
∣a−b∣
≤10
−6
.
示例1
输入
复制
311 131 24 1 2
48 20 4 0 0
36 0 0 1 0
35 15 1 0 0
输出
复制
99.523505378
示例2
输入
复制
224 133 15 0 0
45 14 0 0 0
57 0 2 1 0
15 16 0 0 0
输出
复制
100.051026393
示例3
输入
复制
324 210 26 2 2
13 14 1 0 0
102 0 3 3 0
9 4 0 0 0
输出
复制
99.369444233
备注:
Noticed that the rules of maimai ; DX ; 2077maimaiDX2077 are different from maimai ; DX ; 2022maimaiDX2022.
题意:
思路:
#include
using namespace std;
double pw[5][5] = {
{1,1,0.8,0.5,0},
{2,2,1.6,1.0,0},
{3,3,2.4,1.5,0},
{5,5,2.5,2,0},
{1,0.5,0.4,0.3,0} //附加分判定
};
int main(){
double A0 = 0, A = 0, B0 = 0, B = 0;
for(int i = 0; i < 4; i++){
for(int j = 0; j < 5; j++){
int x; cin>>x;
A0 += pw[i][j]*x; //获得的分数
A += pw[i][0]*x; //全部perfet的分
if(i==3){
B0 += pw[4][j]*x; //获得的附加分
B += pw[4][0]*x; //全部perfet的附加分
}
}
}
printf("%.10lf\n",A0/A*100+B0/B);
return 0;
}
链接:https://ac.nowcoder.com/acm/contest/38727/H
来源:牛客网
题目描述
Zero-chan has a rooted tree with nn nodes. The root of given tree is node 11. She defines f(x)= \prod_{i=1}^nlca(x,i)f(x)=∏
i=1
n
lca(x,i).
lca(u,v)lca(u,v) meas the Least Common Ancestor of node uu and node vv.
Zero-chan gives you some integers xx and asks you to calculate: the number of suffix zeros of f(x)f(x)
输入描述:
First line contains 2 integers n,qn,q (1\leq q\leq n\leq 10^5)1≤q≤n≤10
5
) - the size of given tree and the number of queries.
Each of the next n -1n−1 lines contains two integers u,vu,v (1\leq u,v\leq n, u \neq v1≤u,v≤n,u
=v) indicating an undirected edge between node uu and node vv. It is guaranteed that the given edges form a tree.
The following line containing qq integers describes the queries. Each of query has a integer xx (1\leq x \leq n1≤x≤n).
输出描述:
For each query, print a integer - the answer of the query.
示例1
输入
复制
5 5
2 3
5 4
2 5
1 5
1 2 3 4 5
输出
复制
0
2
1
2
0
题意:
思路:
#include
using namespace std;
typedef long long LL;
#define IOS ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
const int maxn = 1e5+10;
int n, q;
vector<int>G[maxn];
LL siz[maxn], a2[maxn], a5[maxn];
void dfs(int x, int f){
siz[x] = 1;
for(int y : G[x]){
if(y==f)continue;
dfs(y,x);
siz[x] += siz[y];
}
}
LL ans[maxn];
void dfs2(int x, int f, LL t2, LL t5){
ans[x] = min(t2,t5);
for(int y : G[x]){
if(y==f)continue;
dfs2(y,x, t2+a2[y]*siz[y]-a2[x]*siz[y], t5+a5[y]*siz[y]-a5[x]*siz[y]);
}
}
int main(){
IOS;
cin>>n>>q;
for(int i = 2; i <= n; i++){
int u, v; cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
for(int i = 1; i <= n; i++){
int t = i;
while(t%2==0){ t/=2; a2[i]++; }
while(t%5==0){ t/=5; a5[i]++; }
}
dfs(1,-1);
dfs2(1,-1, 0, 0);
for(int i = 1; i <= q; i++){
int x; cin>>x;
cout<<ans[x]<<"\n";
}
return 0;
}
链接:https://ac.nowcoder.com/acm/contest/38727/E
来源:牛客网
题目描述
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators have permission to muzzle a user for some days.
There is a famous activity called ‘‘Fudu’’, which means repeating the sentence from the last guy sent.
As we all known, the penultimate person who do ‘‘Fudu’’ will be muzzled.
But Administrator Mieputrygub Bot thinks it’s too boring, so he decided to muzzle the last pp-th person who do ‘‘Fudu’’.
Now, there are nn persons in a chat group who want to do ‘‘Fudu’’. If few people participate in ‘‘Fudu’’, it will be boring, so the number of participants nn will be greater than or equal to pp. If everyone does ‘‘Fudu’’, it is certain that existing a man who is the last pp-th.
However, the way they do ‘‘Fudu’’ is unusual, there will be several rounds. In each round, nn persons perform the following actions in sequence.
If he did ‘‘Fudu’’ in the any previous rounds, he can’t do ‘‘Fudu’’ in this round. It means each person can do ‘‘Fudu’’ only once.
Otherwise, he can choose whether to do ‘‘Fudu’’.
If there is a round nobody do ‘‘Fudu’’, the process of doing ‘‘Fudu’’ will end.
For the person ii, if he is the jj-th person to do ‘‘Fudu’’, he can get a_{i,j}a
i,j
bottles of Ice Black Tea.
However, if he was the last pp-th person to do ‘‘Fudu’’, he will be muzzled, not get any Ice Black Tea. He also need to give Mieputrygub Bot 154154 bottles of Ice Black Tea.It means he get -154−154 bottles of Ice Black Tea.
If the last pp-th person does not exist, nobody will be muzzled.
Everyone wants to maximize the amount of Ice Black Tea they can get, you need to find out how much Ice Black Rea that each person can get finally.
输入描述:
The first line contains two postive integers n,pn,p (1 \le p \le n \le 10^{3}1≤p≤n≤10
3
).
Next nn lines, ii-th line contains nn postive integers a_{i,1},a_{i,2},\dots,a_{i,n}a
i,1
,a
i,2
,…,a
i,n
(1 \le a_{i,j}\le 10^{9}1≤a
i,j
≤10
9
).
For j\neq kj
=k, a_{i,j}\neq a_{i,k}a
i,j
=a
i,k
.
输出描述:
Output one line with nn integers, ii-th integers means the number of Ice Black Tea ii-th person will get.
示例1
输入
复制
3 2
1 14 5
141 9 1
9 8 10
输出
复制
1 0 0
说明
The first person in the first round will do “Fudu” and get 11 bottle of Ice Black Tea.
And the remaining two are holding each other back.(If someone first do “Fudu” in this round , then another one can do “Fudu” in the next round to let first one be the last 22-th person who do “Fudu”)
示例2
输入
复制
5 3
1000 4 3 2 1
4 1000 3 2 1
4 3 1000 2 1
4 3 2 1000 1
4 3 2 1 1000
输出
复制
1000 1000 0 0 0
题意:
思路:
#include
using namespace std;
const int maxn = 1010;
int a[maxn][maxn];
int main(){
int n, p; cin>>n>>p;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
cin>>a[i][j];
for(int i = 1; i <= n; i++){
if(i<=n%p)cout<<a[i][i]<<" ";
else cout<<0<<" ";
}
return 0;
}
链接:https://ac.nowcoder.com/acm/contest/38727/J
来源:牛客网
题目描述
Jellyfish can only long drift throughout their lives as if they have no thoughts of their own. But you know, how we know that jellyfish really have no dreams, right? — S4M, Jellyfish
You are given a 00-indexed array aa of length nn where a_i\in{0,1,2}a
i
∈{0,1,2}.
You can perform the operation below:
Choose an index ii such that (a_i+1)\bmod 3=a_{(i+1)\bmod n}(a
i
+1)mod3=a
(i+1)modn
, then let a_i \gets (a_i+1)\bmod 3a
i
←(a
i
+1)mod3.
Jellyfish’s dream is to make all elements equal. Check if its dream could be achieved after performing some (possibly zero) operations.
输入描述:
Each test contains multiple test cases. The first line contains the number of test cases TT (1\leq T\leq 10^51≤T≤10
5
). Description of the test cases follows.
The first line contains a single integer nn (2 \leq n \leq 10^62≤n≤10
6
).
The second line contains nn integers a_0,a_1,\ldots,a_{n-1}a
0
,a
1
,…,a
n−1
(0 \leq a_i <30≤a
i
❤️).
It is guaranteed that the sum of nn over all test cases does not exceed 10^610
6
.
输出描述:
For each test case, output one line. If all element can be equal after some (possibly zero) operations, print “Yes”, otherwise print “No”.
You can print letters in any case (upper or lower).
示例1
输入
复制
5
2
1 0
3
0 2 1
4
0 1 2 2
5
0 2 1 0 1
6
2 0 2 1 0 1
输出
复制
Yes
No
Yes
No
Yes
题意:
思路:
#include
using namespace std;
const int maxn = 2e6+10;
int a[maxn];
int main(){
ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);
int T; cin>>T;
while(T--){
int n; cin>>n;
for(int i = 0; i < n; i++) cin>>a[i];
int x=0,y=0;
for(int i = 0; i < n; i++){
if(a[i]!=a[(i+1)%n]){
if((a[i]+1)%3==a[(i+1)%n]) x++;
else y++;
}
}
if(x>=y)cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}