当前位置:网站首页>Issue 36 summary of atcoder beginer contest 248
Issue 36 summary of atcoder beginer contest 248
2022-04-23 05:38:00 【joe_ Zxq's programming world】
4 month 16 Japan ( Saturday ) Another fight ABC.
result :A,B topic AC(300 branch ),C、D topic TLE.
Catalog
website
Video Explanation
A topic
Title Description
A - Lacked Number /
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 100 points
Problem Statement
You are given a string S of length exactly 9 consisting of digits. One but all digits from 0 to 9 appear exactly once in S.
Print the only digit missing in S.
Constraints
S is a string of length 9 consisting of digits.
All characters in S are distinct.
Input
Input is given from Standard Input in the following format:
S
Output
Print the only digit missing in S.
Sample Input 1
Copy
023456789
Sample Output 1
Copy
1
The string 023456789 only lacks 1. Thus, 1 should be printed.
Sample Input 2
Copy
459230781
Sample Output 2
Copy
6
The string 459230781 only lacks 6. Thus, 6 should be printed.
Note that the digits in the string may not appear in increasing order.
Topic analysis
The main idea of the topic :
Enter a string , contain 0~9 Medium 9 A digital , Number of missing outputs .
Ideas :
Prioritize , Then loop the string from beginning to end . When i≠s[i], Output i,return 0. If you haven't done it all over again return 0, Direct output 9( The blogger just started cout<<9,WA 了 2 Time ).
Title code
Initial submission WA Code :
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
sort(s.begin(),s.end());
for(int i=0;i<s.size();i++) if(s[i]!=i+'0') {
cout<<i;
return 0;
}
return 0;
}
//ACplease!!!
/* printf(" \n");
printf(" \n");
printf(" * * * * * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * \n");
*/
Resubmitted WA Code :
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
sort(s.begin(),s.end());
for(int i=0;i<(int)s.size();i++) if(s[i]!=i+'0') {
cout<<i;
return 0;
}
return 0;
}
//ACplease!!!
/* printf(" \n");
printf(" \n");
printf(" * * * * * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * \n");
*/
final AC Code :
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
sort(s.begin(),s.end());
for(int i=0;i<(int)s.size();i++) if(s[i]!=i+'0') {
cout<<i;
return 0;
}
cout<<9;
return 0;
}
//ACplease!!!
/* printf(" \n");
printf(" \n");
printf(" * * * * * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * \n");
*/
Knowledge explanation
If Xiaobai doesn't understand Sort , You can read this article I wrote :
B topic
Title Description
B - Slimes /
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 200 points
Problem Statement
There are A slimes.
Each time Snuke shouts, the slimes multiply by K times.
In order to have B or more slimes, at least how many times does Snuke need to shout?
Constraints
1≤A≤B≤10
9
2≤K≤10
9
All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B K
Output
Print the answer.
Sample Input 1
Copy
1 4 2
Sample Output 1
Copy
2
We start with one slime. After Snuke's first shout, we have two slimes; after his second shout, we have four slimes. Thus, he needs to shout at least twice to have four or more slimes.
Sample Input 2
Copy
7 7 10
Sample Output 2
Copy
0
We have seven slimes already at the start.
Sample Input 3
Copy
31 415926 5
Sample Output 3
Copy
6
Topic analysis
The main idea of the topic :
There is a kind of Slim . Every time Snuke When shouting , Slim will multiply by K times .
In order to have B Or more shrems ,Snuke At least how many times ?
Ideas : Water problem …… Direct infinite loop , Double every time , When quantity ≥B when , Jump out of .
Title code
AC Code ( water ……):
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,k;
cin>>a>>b>>k;
for(long long i=0;;i++){
if(a>=b){
cout<<i;
return 0;
}
a*=k;
}
return 0;
}
//ACplease!!!
/* printf(" \n");
printf(" \n");
printf(" * * * * * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * \n");
*/
Title remarks
Someone doesn't believe me WA.
Welcome to the voting collection at the bottom of the article .
C topic
Title Description
C - Dice Sum /
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 300 points
Problem Statement
How many integer sequences of length N, A=(A
1
,…,A
N
), satisfy all of the conditions below?
1≤A
i
≤M (1≤i≤N)
i=1
∑
N
A
i
≤K
Since the count can get enormous, find it modulo 998244353.
Constraints
1≤N,M≤50
N≤K≤NM
All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M K
Output
Print the answer.
Sample Input 1
Copy
2 3 4
Sample Output 1
Copy
6
The following six sequences satisfy the conditions.
(1,1)
(1,2)
(1,3)
(2,1)
(2,2)
(3,1)
Sample Input 2
Copy
31 41 592
Sample Output 2
Copy
798416518
Be sure to print the count modulo 998244353.
Topic analysis
The main idea of the topic :
A short topic , No explanation. .
Ideas : TLE See code for ideas .
Title code
recursive TLE Code :
#include<bits/stdc++.h>
using namespace std;
long long ans=0,n,m,k;
void dfs(long long num,long long sum,long long pos){
sum+=num;
if(pos==n&&sum<=k){
ans++;
return;
}
if(sum>k) return;
for(long long i=1;i<=m;i++)
dfs(i,sum,pos+1);
}
int main(){
cin>>n>>m>>k;
dfs(0,0,0);
cout<<ans%998244353;
return 0;
}
//ACplease!!!
/* printf(" \n");
printf(" \n");
printf(" * * * * * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * \n");
*/
Other
D topic TLE.
Nothing else .
my Atcoder account number
joe_zxq - AtCoderhttps://atcoder.jp/users/joe_zxq
Copyright notice
————————————————
Copyright notice : This paper is about CSDN Blogger 「joe_zxq21」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement , Do not welcome Welcome to reprint and pay attention to .
Vote collection
版权声明
本文为[joe_ Zxq's programming world]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230537311353.html
边栏推荐
猜你喜欢
转置卷积(Transposed Convolution)
Excel 2016 cannot open the file for the first time. Sometimes it is blank and sometimes it is very slow. You have to open it for the second time
mysql中duplicate key update
Fletter next generation graphics renderer impaller
‘EddiesObservations‘ object has no attribute ‘filled‘
Breadth first search topics (BFS)
Interview Basics
deep learning object detection
Nécessité de précharger les cookies dans le sélénium
Differences between sea level anatomy and sea surface height anatomy
随机推荐
Linear sieve method (prime sieve)
Escape characters \ splicing of data formats
what is wifi6?
SQL statement simple optimization
Vscode settings JSON configuration
shell指令学习1
Generation of straightening body in 3D slicer
open3d材质设置参数分析
Nécessité de précharger les cookies dans le sélénium
uni使用的一些坑
Arithmetic and logical operations
使用宝塔+xdebug+vscode远程调试代码
Reading notes of modern methods of C language programming
Data bus realizes the communication between brother components
windows连接mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)
Relative reference and absolute reference of Excel
[triangle Yang Hui triangle printing odd even cycle JS for break cycle]
Breadth first search topics (BFS)
The address value indicated by the pointer and the value of the object indicated by the pointer (learning notes)
3d slicer中拉直体的生成