当前位置:网站首页>Summer summary (II)
Summer summary (II)
2022-07-29 07:18:00 【Dan·】
This week, I didn't brush the questions too much , Every day A There are not many questions , But this week, I sorted out some knowledge points , Wrote some notes , Because every time I look at the problem solution, I find that I don't have too many knowledge points , It's always stuck , So this week will focus on knowledge points first . But I found out , After reading the title, the solution , After the whole code is completely understood , Write it yourself , This time one-time A The possibility is very, very large , The latest questions 1A There's a high probability that . This week I want to write two topics that I have been thinking about for a long time :
1、P1808 Word classification
A question that feels very skilled , Try it first sort Function sorts the input string , Then put the sorted string into set Collection ( To borrow set Set off the weight ), Last set The number of elements in is the answer .
#include<bits/stdc++.h>
using namespace std;
set<string> words;
int main(){
int t;
string temp;
cin>>t;
while(t--){
cin>>temp;
sort(temp.begin(),temp.end());
words.insert(temp); }
cout<<words.size()<<endl;
return 0;
}
2、P1029 The problem of maximum common divisor and minimum common multiple
Refer to the code idea of the problem solution , You can see that no matter which one P,Q They are all satisfied P × Q = x 0 × y 0 , Then we can use one q Express y 0 Divide x 0 Value ( If it's not divisible , Output 0), And then from 2 Start looking at q What number can I divide by , Use one ans recorded , The final answer is ans Of 2 Power , Here imitate the way of the boss , Shift one delegate left 2 To the power of .
#include<iostream>
using namespace std;
int x, y;
int main() {
cin >> x >> y;
if ((y%x) != 0) {
cout << 0 << endl;}
else {
int q
q= y / x;
int begin = 2;
int ans = 0;
while (q > 1) {
if ((q%begin) == 0) {
ans++;
while ((q%begin) == 0) {
q /= begin;}
}
begin++;
}
cout << (1 << ans) << endl;
}
return 0;
}
The next week will focus on questions , come on. !
边栏推荐
- Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
- 约瑟夫环问题
- JS chicken laying eggs and egg laying chickens. Who appeared earlier, object or function? Is function an instance of function?
- Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
- Vite3.0都发布了,你还能卷得动吗(新特性一览)
- Why does ETL often become ELT or even let?
- 2022-07-28:以下go语言代码输出什么?A:AA;B:AB;C:BA;D:BB。 package main import ( “fmt“ ) func main() { f
- 太空射击第17课: Game Over (結束)
- Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)
- Gin routing, parameters, output
猜你喜欢
![Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)](/img/8b/f68503e09f218c26e34453b1b7fcd5.png)
Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)

Nodejs installation tutorial

Redis基础篇

JS chicken laying eggs and egg laying chickens. Who appeared earlier, object or function? Is function an instance of function?

微服务远程调用

win11VMware打开虚拟机就蓝屏重启以及启动不了的解决方案

个人博客系统(附源码)

WPF simple login page completion case

Leetcode 879. profit plan

2022-07-28:以下go语言代码输出什么?A:AA;B:AB;C:BA;D:BB。 package main import ( “fmt“ ) func main() { f
随机推荐
Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
H3C_ Using setting default static routing priority to realize the active and standby function of export dual lines
VMware16创建虚拟机:无法创建新虚拟机,不具备执行此操作的权限
WPF简单登录页面的完成案例
实现改变一段文字的部分颜色效果
pytest合集(7)— 参数化
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
Latest 10 billion quantitative private placement list
gcc/g++的使用
Error 1045 (28000) access denied for user 'root' @ 'localhost' solution
JS chicken laying eggs and egg laying chickens. Who appeared earlier, object or function? Is function an instance of function?
Flink real-time warehouse DWD layer (processing complex data - installation and replacement of streams and tables) template code
gin 中间件
tp6 使用 ProtoBuf
Variables and encryption in ansible
Gin parameter validation
上采样之反卷积操作
Image noise and matrix inversion
数组的子集不能累加出的最小正数
Operator3 - design an operator