「一本通 2.3 例 1」Phone List

3分钟掌握手机号查QQ号:开源工具phone2qq原理与实战指南 在网络通信与数据交互中,API接口调用是连接客户端与服务端的核心技术。其原理是通过模拟合法请求格式与加密协议,实现特定信息的查询功能。这项技术的价值在于理解客户端-服务器交互模型,并能在授权前提下实现便捷的身份关联查询。在实际应用场景中,TEA加密算法常用于保障数据传输安全,而Python脚本则能快速实现请求模拟与响应解析。本文以phone2qq工具为例,深入解析如何通过构造加密请求与解析响应,安全合法地实现手机号与QQ号的关联查询,并探讨了隐私保护与合法使用边界。 阅读详情

题目链接:https://loj.ac/problem/10049

思路:字典树模板题具体看代码

#include<bits/stdc++.h>
#define ll long long
#define N 100861
#define inf 0x3f3f3f3f
using namespace std;
int ch[10][N],tot;
bool book[N];
void Init()
{
    memset(ch,0,sizeof(ch));
    memset(book,false,sizeof(book));
}
int solve(char s[])
{
    int l=strlen(s);
    int flag=0,u=1;//u是用来记录所在位置的,初始化当前位置为节点1
    for(int i=0;i<l;i++)
    {
        int c=s[i]-'0';
        if(!ch[c][u])//如果从当前位置没有一条通向数字c的路
            ch[c][u]=++tot;//创建一个新节点,并把这条边给记录
        else if(i==l-1)//如果从当前位置有一条通向数字c的路且当前单词已经结束
            flag=1;//说明这个单词是前面所输入单词其中几个的前缀
        u=ch[c][u];//令u等于当前节点所指向的节点
        if(book[u])//如果当前节点所指向的节点位置是一个单词的尾部
            flag=1;
    }
    book[u]=true;//把单词尾部标记为true
    return flag;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        Init();
        tot=1;
        bool flag=false;
        for(int i=0;i<n;i++)
        {
            char s[11];
            scanf("%s",s);
            if(solve(s))
                flag=true;
        }
        if(flag)
            printf("NO\n");
        else
            printf("YES\n");
    }
    return 0;
}

 

荣耀Robot Phone技术解析:从移动开发到具身智能的范式变革 机器人操作系统(ROS)作为机器人开发领域的核心框架,通过提供标准化的通信中间件、设备抽象和工具链,实现了机器人各功能模块的松耦合与高效协同。其核心原理在于节点化的分布式架构,允许感知、规划、控制等任务并行处理,并通过话题、服务等机制进行数据交换。这一技术价值在于大幅降低了机器人软件的开发门槛与集成复杂度,为智能体在动态环境中的自主决策与任务执行奠定了基础。其应用场景广泛覆盖了从工业自动化到服务机器人的多个领域。随着移动设备形态的演进,以荣耀Robot Phone为代表的“具身智能移动终端”正将ROS的核心 阅读详情

相关推荐

『杭电1671』Phone List

Problem Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: 1. Emergency 911 2. Alice 97 625 999 3. Bob 91 12 54 26 In this cas

漠宸离若的博客 315

#10049. 「一本通 2.3 例 1」Phone List(Trie字典树)(求一个字符串是另一个字符串的前缀)(模板题)

Phone List 题目描述 题目来源:题目 给定 n 个长度不超过 10 的数字串,问其中是否存在两个数字串 S、T,使得 S是 T 的前缀,多组数据。 输入格式 第一行一个整数 T,表示数据组数。 对于每组数据,第一行一个数 n,接下来 n 行输入 n 个数字串。 输出格式 对于每组数据,若存在两个数字串 S,T,使得 S 是 T 的前缀,则输出 NO ,否则输出 YES 。 请注意此处结果与输出的对应关系! 样例输入 2 3 911 97625999 91125426 5 113 12340 12

Lily的博客 650

Phone list

一个可以在Windows 任何版本下运行的电话本程序.本软件是完全免费的.你可以放心下载.

#10049. 「一本通 2.3 例 1」Phone List

#10049. 「一本通 2.3 例 1」Phone List 大意:给 n 个数字串,问是否有 s 串是 t 串的前缀 思路:把串有长到短排序,建字典树,遇到结束点为已经见过的输出。 #include <bits/stdc++.h> using namespace std; const int maxn = 1e5+500; int tre[maxn<<2][11...

DeadWooder 279

IEEE Access 上岸指南,附含泪整理的 cover letter 、沟通邮件、终版文档等资料包

终于上岸了! 我是一个小硕,本科期间发表过两篇水文,奈何学校有更高的毕业要求,只能硬着头皮尝试一下 SCI。 想投 IEEE Access 的朋友都应该知道 小木虫论坛 对这个期刊的讨论,褒贬不一,有的人说是大水刊,有的人说有难度。 比如: @wow_: 不可否认,灌水期刊。只要之前中过一篇,再投基本没有不录用的!我们实验室其他老师说过一区除外的收费期刊都应该禁止灌水。 @pssp: 审稿人还...

kurryluo的博客 1万+

Python 列表(list)所有方法超全汇总

以上就是 Pythonlist 列表全部 11 个内置方法的完整汇总,全覆盖、无遗漏。掌握所有列表方法,基本可以应对 99% 的列表操作场景,无论是日常开发、数据分析还是算法刷题都能高效编码。

jdksjw的博客 234

POJ - 3630 /#10049. 「一本通 2.3 例 1」Phone List(字典树模板题)

就™你叫“传送门”啊~ 秋雅是我弟妹! 分析:样例中前缀在含有前缀的字符串前边,还有一种可能就是字符串先输入,再输入其含有的前缀字符串。所以可以在插入函数中记录该字符出现的次数(如果 后缀后出现,后缀的最后尾字母次数大于1说明前边有字符串了)和标记最后一个字母的位置(标记可能出现的后缀)。标记的三个数组一定要大于十万,n最多有一万个字符串,每个字符串最好含10个字符。 AC代码: #include<stdio.h> #include<algorithm> #include<

大聪明的博客 673

Chatbox使用指南

Chatbox使用指南

weixin_65289420的博客 2万+

#10049. 「一本通 2.3 例 1」Phone List(trie树应用)

POJ3630: 给定 个长度不超过 的数字串,问其中是否存在两个数字串 ,使得 是 的前缀,多组数据. 输入格式 第一行一个整数 ,表示数据组数。 对于每组数据,第一行一个数 ,接下来 行输入 个数字串。 输出格式 对于每组数据,若存在两个数字串 ,,使得 是 的前缀,则输出 NO ,否则输出 YES 。 请注意此处结果与输出的对应关系! #include<bits/stdc++.h> using namespace std; const int maxn=200005; st

qq_41856950的博客 309

c++多线程(1)------创建和管理线程td::thread

std::thread 是 C++11 标准库中用于创建和管理线程的核心类,定义在 <thread> 头文件中。它使得多线程编程变得简单、类型安全且跨平台。

jndingxin的专栏 647

当版图同学只给GDS文件时,我是这样用Calibre PEX和Cadence做后仿真的(保姆级避坑)

本文详细介绍了在模拟IC设计中,当仅获得GDS文件时,如何利用Calibre PEX和Cadence进行高效后仿真的完整流程。涵盖从寄生参数提取到Spectre模型创建的实战技巧,特别针对版本兼容性、文件独立性和参数可调性等常见问题提供解决方案,帮助工程师规避协作中的典型陷阱。

weixin_42556197的博客 243

字典树 - Phone List - 一本通 2.3 例 1

题目大意:如果任一字符串为其他字符串的前缀则输出NO否则输出YES。

奥里给 245

保姆级教程:用CST 2023一步步复现一个1-8GHz Vivaldi天线(含参数优化与结果分析)

本文提供了一份详细的CST 2023教程,指导读者如何从零开始设计并优化1-8GHz Vivaldi天线。内容涵盖工程设置、参数化建模、仿真加速技巧以及性能优化策略,特别适合需要实现宽带天线设计的工程师和研究人员。通过实战案例,帮助用户掌握Vivaldi天线的核心设计要点和CST高级功能应用。

weixin_30800987的博客 618

Phone List(trie树)

D - Phone List Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Given a list of phone numbers, determine if it is consistent in th

梧桐下的四叶草 632

34 python 时间和日期

介绍python里时间和日期的常用方法,以及案例,还有注意事项。

水滴爬呀爬 347

uniapp(全端兼容) - 最新实现全局设置修改字体大小功能,统一修改全部页面所有文字的大小(标准/小/中/大字号切换,用户修改后整个项目立即生效)设置应用字体的大小(详细示例代码,一键复制开箱即用

uni-app,支付宝微信小程序,h5,手机端H5网页,移动端网站,安卓app,ios苹果app,nvue,全局设置字体大小,退出后还能记录字号大小,uniApp将全部页面的字体字号进行修改,uniapp设置改变全局字体大小功能,动态调整应用字体大小,详细教程,动态显示字体大小,可调整显示字体大小,如何解决不同端字体大小的问题,除了rem还有什么方法,设置全局字体大小,用户设置字号大小,应用字体大中小,实现用户全局设置应用字体大小,老年模式字体设置思路,h5端不行怎么办,移动端不生效,修改全局字号,一键改整

✅ 精选推荐文章 8885

【例题1】Phone List(信息学奥赛一本通- P1471)

反直觉的输出结果:存在前缀冲突输出NO(代表拨号系统不安全/不可行),不存在前缀冲突才输出YES。极容易写反导致全盘WA。多组数据读入错位(WA杀手):在发现冲突时,很多同学的第一反应是break结束当前测试用例的循环以节省时间。但这会导致剩下的输入流残留在缓冲区,下一轮的cin>>n会读到一个毫无意义的电话号码,引发雪崩式错位。必须设置状态位并老老实实读完所有输入。memset导致超时:严禁在多组数据题中对十万级大数组使用memset,必须手动循环按需清空[0,pc]区间。

布心老混子 所有代码均老混子本人远古手搓 易错点均为学生真实场景 博客文章部分借助ai生成 463

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Phone List(字典树 or 排序)

Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: 1. Emergency 911

userluoxuan的专栏 937

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Phone List

题目:Phone List 题解:先按照长短从从长到短排序,如果插入一个短的,并且它的结束标志还有的话,就是NO #include <map> #include <stack> #include <queue> #include <vector> #include <cstdio> #include <string> #inc...

多一些不为什么的坚持 850

HDU1671 Phone List

题目: Phone List Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers:Emer

Monster_Day的博客 5073

CCUT OJ——Phone List

本题采用Trie树思路。

椰萝Yerosius,开源运动支持者,主要研究计算机科学、人工智能、Linux系统、数据结构与算法。 818
上一篇: Apple Tree————POJ—3321
下一篇: 10050. 「一本通 2.3 例 2」The XOR Largest Pair
admin__
博客等级 码龄8年 3粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值