当前位置:网站首页>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. !
边栏推荐
- 最新百亿量化私募名单
- Use vscode to configure Mysql to realize connection, query, and other functions
- SpingBoot整合Quartz框架实现动态定时任务(支持实时增删改查任务)
- tp6 使用 ProtoBuf
- Decompilation of wechat applet
- Spark Learning Notes (VII) -- spark core core programming - RDD serialization / dependency / persistence / partition / accumulator / broadcast variables
- Vmware16 create virtual machine: cannot create a new virtual machine, do not have permission to perform this operation
- Why does ETL often become ELT or even let?
- Homebrew brew update doesn't respond for a long time (or stuck in updating homebrew...)
- 【OpenGL】着色器(Shader)的使用
猜你喜欢

Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software

怎么会不喜欢呢,CICD中轻松发送邮件

spark学习笔记(七)——sparkcore核心编程-RDD序列化/依赖关系/持久化/分区器/累加器/广播变量

Some tips of vim text editor

以太网接口介绍

女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....

SpingBoot整合Quartz框架实现动态定时任务(支持实时增删改查任务)

外包干了3年,跳槽后转自动化测试工资是原来的2倍,秘诀原来是......

Docker最新超详细教程——Docker创建运行MySQL并挂载

Decompilation of wechat applet
随机推荐
怎么会不喜欢呢,CICD中轻松发送邮件
实现改变一段文字的部分颜色效果
js中break与continue和return关键字
聊天机器人有何用处?有何类型?看完这些就明白了!
npm install报错npm ERR Could not resolve dependency npm ERR peer
Kubernetes (五) ---------部署 Kubernetes Dashboard
Zabbix 其他基础监控项
Redis基础篇
Flink real-time warehouse DWD layer (Kafka associated with MySQL lookup join) template code
Vagrant box cluster processing
论文阅读 (62):Pointer Networks
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
【charles日常问题】开启charles,使用不了钉钉
Guess the number / / generate a random number for the first time
Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
Latest 10 billion quantitative private placement list
npm install 时,卡住不动,五种解决方法
约瑟夫环问题
Flink real-time warehouse DWD layer (order placing multiple tables to realize join operation) template code
我的个人网站不让接入微信登录,于是我做了这个