当前位置:网站首页>Game (2) of 2022 Henan Mengxin League: solution to supplementary questions of Henan University of Technology
Game (2) of 2022 Henan Mengxin League: solution to supplementary questions of Henan University of Technology
2022-07-23 14:34:00 【QingQingDE23】
2022 Henan Mengxin League No ( Two ) site : Hanan University of Technology
Just one question , The two questions of the three check-in questions are all right, but they are not written , I can only say that I'm still too delicious , Need to work on !
F Garage Kit
I'm a fool , I have considered the meaning of the topic , But why didn't you count the enumeration and it won't timeout , Sorry, I will take time complexity seriously in the future
This question is from 1 Start enumerator to the third power , Look, that's n Constraints , Because it is exponential growth , So there's no overtime , Fortunately, I'm still silly where I count all 1e9 The qualified rational number within ran for a long time without writing it , What a fool
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int T;
int n, m;
int main()
{
cin>>T;
while(T -- ){
cin>>n;
int res = 0;
for(int i = 1; i * i * i <= n; i ++ ){
if(n % (i * i * i) == 0) res ++ ;
}
cout<<res<<endl;
}
return 0;
}
J Sign in
Another question to prove that I am a fool , The idea is the same as the positive solution , But my own consideration is too complicated , Pay attention to simplifying your code in the future , The greatest truths are the simplest , It's a coincidence , Great sound is hard to hear , The great form has no shape
use n^2 The complexity of all a+b Count in map in , after n ^2 enumeration d-c, seek map Whether this number exists in , Don't add a bunch of restrictions to your imagination , Finally, the card timed out
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int a[N];
int n;
map<int, int>mp;
int main()
{
cin>>n;
for(int i = 1; i <= n; i ++ ) cin>>a[i];
sort(a + 1, a + 1 + n);
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= n; j ++ ){
mp[a[i] + a[j]] = 1;
}
}
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= n; j ++ ){
if(mp[a[j] - a[i]] == 1){
cout<<"Yes"<<endl;
return 0;
}
}
}
cout<<"No"<<endl;
return 0;
}
L HPU
Simple check-in
#include<bits/stdc++.h>
using namespace std;
string str;
int ans;
int main()
{
cin>>str;
for(int i = 0; i < str.length(); i ++ ){
if(str[i] == 'H' && str[i + 1] == 'P' && str[i + 2] == 'U'){
ans ++ ;
}
}
cout<<ans<<endl;
return 0;
}
边栏推荐
- Find the maximum area of the island -- depth first search (staining method)
- Day 5 experiment
- Offline data interoperability
- Several hole filling methods of point cloud (mesh) (1)
- 链下数据互操作
- ThreadLocal interview Kills 11 consecutive questions
- ArcGIS uses DEM data to delineate the specific steps and processes of catchment area
- 子序列 --- 编辑距离
- Chapter 2 basic query and sorting
- R语言实战应用案例:绘图篇(三)-多种组合图型绘制
猜你喜欢

npm warn config global `--global`, `--local` are deprecated. use `--location=global` instead.

STM32输出SPWM波,HAL库,cubeMX配置,滤波后输出1KHz正弦波

ValidationError: Invalid options object. Dev Server has been initialized using an options object th

Spotlight light box JS plug-in full screen enlarged picture

10年软件测试工程师经验,很茫然....

链表复习!

求岛屿最大面积--深度优先搜索(染色法)

优化华为云服务器采用Key登陆

spotlight灯箱js插件全屏放大图片

工作小记:一次抓包
随机推荐
几种点云(网格)孔洞填充方法(1)
利用js自动解析执行xss
Antd form - reset method does not work - Basic accumulation - importance of prop
shell跑的时候需要的需要了解命令
LZ77文件压缩
Several hole filling methods of point cloud (mesh) (1)
Aruba学习笔记05-配置架构- WLAN配置架构
(重链剖分)魔法树
关于flex布局justify-content:space-around最后一个不对齐的解决方法和为什么这样子解决是讨论
Design instantiation and connection
JS to implement encode64 encryption
Offline data interoperability
第4章 集合运算
ArcGIS使用DEM数据划定汇水区具体步骤过程
完全背包!
初识并查集
Authing 支持 Zadig 啦!云原生用户统一认证快速对接
[download attached] several scripts commonly used in penetration testing that are worth collecting
Chapter 2 basic query and sorting
Surrounded Regions