当前位置:网站首页>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
边栏推荐
- what is wifi6?
- Strategies to improve Facebook's touch rate and interaction rate | intelligent customer service helps you grasp users' hearts
- QT drawpixmap and DrawImage blur problem
- Write the declaration of a function to return the reference of the array, and the array contains 10 string objects (notes)
- JVM memory and memory overflow exceptions (personal summary)
- Similarities and differences between vector and array (notes)
- Establish excel bookkeeping book through setting context menu
- shell指令学习1
- World and personal development
- acwing854. Floyd finds the shortest path
猜你喜欢
Hongji cyclone RPA provides technical support for Guojin securities and realizes process automation in more than 200 business scenarios
Interview Basics
Necessity of selenium preloading cookies
‘EddiesObservations‘ object has no attribute ‘filled‘
Use of qwbengneview and qwebchannel.
After adding qmenu to qtoolbutton and QPushButton, remove the triangle icon in the lower right corner
Differences between sea level anatomy and sea surface height anatomy
Flutter 新一代图形渲染器 Impeller
Camera imaging + homography transformation + camera calibration + stereo correction
Traversal array, object parent-child communication props / $emit
随机推荐
Nécessité de précharger les cookies dans le sélénium
Solid contract DoS attack
catkin_package到底干了什么
Traversal array, object parent-child communication props / $emit
Golang implements Ping connectivity detection case through exec module
Deep learning object detection
Generation of straightening body in 3D slicer
Flutter nouvelle génération de rendu graphique Impeller
Fast application fuzzy search
‘EddiesObservations‘ object has no attribute ‘filled‘
Box collapse and margin collapse
AcWing 1096. Detailed notes of Dungeon Master (3D BFS) code
OSI层常用协议
使用宝塔+xdebug+vscode远程调试代码
Frequently asked interview questions - 1 (non technical)
50 SQL exercises, answers and detailed analysis
Breadth first search topics (BFS)
世界与个人发展
Frequently asked interview questions - 2 (computer network)
[the background color changes after clicking a line]