PAT a1129

使用Python实现深度学习模型:用户行为预测与个性化服务 在这篇教程中,我们将构建一个深度学习模型,用于用户行为预测和个性化服务。我们将使用TensorFlow和Keras库来实现这一目标。通过这个教程,你将学会如何处理数据、构建和训练模型,并将模型应用于实际的用户行为预测和个性化服务任务。在这篇教程中,我们使用Python构建了一个深度学习模型,用于用户行为预测和个性化服务。我们使用TensorFlow和Keras进行模型的构建和训练,并使用Flask构建了一个Web应用来展示预测结果。希望这个教程对你有所帮助! 阅读详情

 

目的:写评价系统,通过过去的表现,预测用户接下来的操作。

输入:

N  <=50000  查询数目

K  <= 10  最多的评价个数

然后是

输出:

赋值:几个预测值

算法:

边输入边输出。第一个单独处理。

用一个hash表存,出现的次数。

完事排序。

unordered_map + 数组+排序,排序不是对所有元素排序,而是对前K个元素排序。时间复杂度为n。但是有某个测试点出错,至今未找到原因。

#include<stdio.h>
#include<algorithm>
#include<unordered_map>

using namespace std;

int N,K;

unordered_map<int,int> hash1;
int cnt[10] = {0};//记录里面出现最多的标号
int mincnt,num;//mincnt为里面最后一个标号出现的次数,num为里面有效数值为多少个;

bool cmp(int a,int b)
{
    if(hash1[a]!=hash1[b])
    {
        return hash1[a]>hash1[b];
    }else
    {
        return a<b;
    }
}
int main()
{
    scanf("%d%d",&N,&K);

    int v;
    scanf("%d",&v);
    hash1[v] = 1;
    cnt[0] = v;
    mincnt = 1;
    num = 1;

    for(int i=1;i<N;i++)
    {
        scanf("%d",&v);
        printf("%d:",v);
        for(int j=0;j<num&&j<K;j++)
        {
            printf(" %d",cnt[j]);
        }
        printf("\n");
        if(hash1[v]==0)
        {
            hash1[v] = 1;
            if(num<K)
            {
                cnt[num++] = v;
            }else if(hash1[v]==mincnt&&cnt[num-1]>v)
            {
                cnt[num-1] = v;
            }
        }else
        {
            hash1[v]++;
            if(hash1[v]==mincnt&&cnt[num-1]>v)
            {
                cnt[num-1] = v;
            }else if(hash1[v]==mincnt+1&&cnt[num-1]<v)
            {
                cnt[num-1] = v;
            }
        }

        sort(cnt,cnt+K,cmp);
    }
    return 0;
}

unordered_map+数组+排序,排序每次复杂度nlog n,每插入一个元素,排序一次,复杂度n^2log n,远没有用map,set排序快,用set复杂度nlog n;

#include<stdio.h>
#include<unordered_map>
#include<algorithm>

using namespace std;

const int maxn = 50010;
int N,K;
unordered_map<int,int> q;
int l[maxn];
int cnt = 0;
bool cmp(int a,int b)
{
    if(q[a]!=q[b])
    {
        return q[a]>q[b];
    }else
    {
        return a<b;
    }
}
int main()
{
    scanf("%d%d",&N,&K);

    int u;
    scanf("%d",&u);
    q[u] = 1;
    l[cnt++] = u;
    for(int i=1;i<N;i++)
    {
        scanf("%d",&u);
        printf("%d:",u);
        for(int j=0;j<cnt&&j<K;j++)
        {
            printf(" %d",l[j]);
        }
        printf("\n");
        if(q[u]==0)
        {
            l[cnt++] = u;
        }
        q[u]++;
        sort(l,l+cnt,cmp);
    }
    return 0;
}

Hash+Set+unordered_map类型

#include<stdio.h>
#include<set>
#include<unordered_map>

using namespace std;
const int maxn =100000;

unordered_map<int,int> q;
set<int,greater<int> >  book;
int N,K;

int main()
{
    scanf("%d%d",&N,&K);
    int u;
    scanf("%d",&u);
    q[u] = 1;
    book.insert(q[u]*maxn-u);

    for(int i=1;i<N;i++)
    {
        scanf("%d",&u);

        printf("%d:",u);
        int num = 0;
        for(set<int>::iterator it = book.begin();it!=book.end()&&num<K;it++,num++)
        {
            printf(" %d",(maxn-(*it)%maxn));
        }
        printf("\n");

        set<int>::iterator it1 = book.find(q[u]*maxn-u);
        if(it1!=book.end())
        {
            book.erase(it1);
        }
        if(q[u]==0)
        {
            q[u] = 1;
        }else
        {
            q[u]++;
        }
        book.insert(q[u]*maxn-u);
    }
    return 0;
}

unordered_map+set+小于号的重载  set里面的元素键值不能修改

​
#include<stdio.h>
#include<set>
#include<unordered_map>

using namespace std;
const int maxn =100000;

struct node{
    int data;
    int cnt;
    bool operator < (const node &a) const{
        return (cnt!=a.cnt)?cnt>a.cnt:data<a.data;
    }

};

unordered_map<int,int> q;
set<node>  book;
int N,K;

int main()
{
    scanf("%d%d",&N,&K);
    int u;
    scanf("%d",&u);
    q[u] = 1;
    book.insert(node{u,1});

    for(int i=1;i<N;i++)
    {
        scanf("%d",&u);

        printf("%d:",u);
        int num = 0;
        for(set<node>::iterator it = book.begin();it!=book.end()&&num<K;it++,num++)
        {
            printf(" %d",it->data);
        }
        printf("\n");

        set<node>::iterator it1 = book.find(node{u,q[u]});
        if(it1!=book.end())
        {
            book.erase(it1);
        }
        if(q[u]==0)
        {
            q[u] = 1;
        }else
        {
            q[u]++;
        }
        book.insert(node{u,q[u]});
    }
    return 0;
}

​

反思: stl,用得不熟,题目难懂。

数学建模——相关系数(4)——斯皮尔曼相关系数(spearman) 文章目录引述斯皮尔曼相关系数(spearman)定义 引述 经过之前几节的学习,我们了解并掌握了皮尔逊相关系数。在学习中我们发现,皮尔逊相关系数的使用条件相当苛刻:两组变量必须是连续数据、呈现正态分布,且两者间必须成线性关系。如果我们在数学建模中拿到一组数据无法满足以上条件,那么有没有其他的方法去判断两组变量之间的相关性呢?答案是肯定的,它就是斯皮尔曼相关系数(spearman). 斯皮尔曼相关系... 阅读详情

相关推荐

用Python+OpenCV搞定线激光相机标定:从棋盘格到3D点云的保姆级实战

本文详细介绍了使用Python和OpenCV进行线激光相机标定的全流程实战,从硬件准备到3D点云重建。涵盖相机内参标定、激光平面方程拟合、三维重建等关键技术,提供完整的代码实现和工程优化建议,帮助开发者实现毫米级精度的工业检测和三维测量系统。

weixin_29227425的博客 282

PAT A 1129(set内部排序)

emmm,刷到这一题困惑我好久,建一个结构体想使用sort函数却发现实现不了,于是想使用vector进行实现,但是每次需要删除vector中与当前输入值相同的结点,因为需要更新当前值出现次数,但是需要有结点位置才能删除,而vector没有find()函数,但是看到一个大佬使用vector和sort函数实现了,不过代码没有注释,奈何本人太笨了没看懂。于是想用set实现,但是set不能使用sort函数。。。查阅资料get到一种新技能,set内部排序,怕以后忘记,记录下来。 #include <stdi

suiyuewushengly的博客 197

基于FLUENT的圆柱绕流数值模拟与流场优化策略

本文详细介绍了基于FLUENT的圆柱绕流数值模拟方法与流场优化策略。从基础概念、建模技巧到湍流模型选择,全面解析了圆柱绕流模拟的关键技术,并提供了实用的网格划分和参数设置建议。通过具体案例展示了流动控制方法和优化流程,帮助工程师有效降低阻力系数,提升流场性能。

f6g7h8i9j的博客 705

PAT 甲级 1129. Recommendation System

Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user’s preference by the number of time...

zengjingchao的博客 550

ENVI5.6 自动化流程:GF系列卫星影像批处理与质量优化

本文详细介绍了如何利用ENVI5.6构建针对GF-2、GF-6、GF-7系列卫星影像的自动化批处理流水线。通过配置Batch Processing工具,实现从正射校正到图像融合的全流程批量处理,并分享参数设置、质量监控与故障排查的实战经验,旨在显著提升海量遥感影像的处理效率与成果质量。

efc1234567的博客 603

Windows 10下三菱PLC控件安装报错Error Number:-119的终极解决方案(附详细步骤)

本文针对Windows 10系统安装三菱PLC控件时常见的Error Number:-119报错,提供了深度分析与终极解决方案。文章剖析了该错误源于oleaut32.dll文件版本冲突,并详细介绍了通过设置兼容性模式、手动注册DLL、直接安装MX Component以及高级系统修复等多种方法,帮助用户彻底解决此安装难题,顺利搭建PLC开发环境。

weixin_29289821的博客 330

PAT A1129 重载小于号快速解答

参考柳神代码 题目要求从大到小排序,但是set是从小到大排序。本题重载小于号,换成适合本题的大的在前的判断方式,使用set的时候就符合本题的输出了。 #include <iostream> #include <set> using namespace std; int book[50001]; //记录num出现的次数 struct node { int index, cnt; }; //set按从小到大排序,题目需要由大到小排序,重载小于号为大的在前的代码 bool o

weixin_41945646的博客 221

无监督学习与互信息

在机器学习中,获取大量高质量标注数据成本高昂。为解决此问题,无监督学习利用丰富的无标注数据成为研究重点。其中,互信息是衡量两个随机变量之间依赖关系的关键指标,能够捕捉非线性统计关联,非常适合处理非结构化数据。通过最大化神经网络中变量间的互信息,可以有效地从无标注数据中提取有用信息,提升模型在下游任务(如分类)的性能。互信息与熵密切相关,其值等于联合分布与边缘分布乘积间的KL散度,也可通过熵与条件熵的差值得出,具有对称性,并反映了已知一个变量后另一个变量不确定性的减少。

盼小辉丶的博客 3527

PAT A1129 Recommendation System (25 分)排序 优先队列

题目大意:设计一个推荐系统。用户有N次输入,每次输入的是一件商品的 id (1~N),要求从第2次输入开始推荐,即列出用户之前搜索次数最多的K件商品(不足K件没关系,但是不能超过K件)。对于搜索次数相同的,按照 id 排序。N <= 50000, K <= 10。 首先设置结构体 query记录次数和 id,然后就是根据用户每次的输入来推荐。问题主要是对于 N = 5...

HackingGate的博客 214

【SA8155P】AIS Camera相关内容的简单介绍

【SA8155P】AIS Camera相关内容的简单介绍

静谧、淡雅 1699

【Python_PySide6学习笔记(二十四)】菜单栏QMenuBar类的基本用法

此篇文章中介绍 PySide6 中 QMenuBar 类的基本用法,包括"创建菜单栏"、"创建一级菜单"、"创建二级菜单"等,会持续更新,有需要的读者可以点赞收藏,也欢迎在评论区进行讨论。

禾戊之昂的博客 1623

PAT A1129 Recommendation System (用简单排序实现)

题目不多分析了,做题的时候第一思路就是排序,但想着PAT这尿性50000个数据做50000次排序肯定超时,然后发现只需输出最多10个数,想起了用淘汰+部分排序的思想,AC~ 只是做完后发现大佬们都用set实现。。。不知优劣,仅供参考~ /***************2019.9.4-15:35-16:11**************/ //A1129 Recommendation Syst...

Simon博的博客 241

UE5 Niagara基础知识讲解

在UE5版本中,Niagara粒子系统引入了许多可添加的模块,分别用于控制发射器的生成和更新、粒子的生成和更新以及渲染效果。本文采用虚幻5.2.1版本,以图文方式对Niagara基础知识进行讲解。

一碗清深的博客 2468

PAT 1129. Recommendation System (25)

题目地址:https://www.patest.cn/contests/pat-a-practise/1129 这个题目做起来还是有点艰辛的,想了好久。 一开始用的map,超时了。后来用set,插入的时候先删除,AC了。主要是用map不能直接按值排序,变相的方法是放在一个线性的容器中,用sort或者qsort去排序,依然超时。用set,插入的时候,先查找元素是否存在,存在则删除,插入一

1247

深度学习工具包 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'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('DeepLearnToolbox'));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('state',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'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',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 = 'sigm';%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, 'Too big error');```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('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';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)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';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, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% 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'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 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, 'Too big error');```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('state',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, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',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, 'Too big error');%% ex3 neural net with dropoutrand('state',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, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % 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, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % 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, 'Too big error');%% 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('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % 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, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

PAT A1129 Recommendation System

PAT A1129 Recommendation System Sample Input: 12 3 3 5 7 5 5 3 2 1 8 3 8 12 Sample Output: 5: 3 7: 3 5 5: 3 5 7 5: 5 3 7 3: 5 3 7 2: 5 3 7 1: 5 3 2 8: 5 3 1 3: 5 3 1 8: 3 5 1 12: 3 5 8 思路 1: 用一个...

qq_42347617的博客 205

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

PAT_A1129#Recommendation System

Source: PAT A1129Recommendation System(25分) Description: Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recomme...

weixin_33810006的博客 191

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

PAT A1129

#include &lt;iostream&gt; #include &lt;algorithm&gt; using namespace std; struct record{ int freq; bool inrec; record(){ freq=0; inrec=false; } }re[50015]; int ans[20]={0},ansindex=0,N,K; bool...

weixin_37565706的博客 513

PAT A1129 2019.09.04 【map】

1129Recommendation System(25分) Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user...

一个非计算机专业的 博客 192

1129. Recommendation System (25)[set集合-排序]

1. 原题:https://www.patest.cn/contests/pat-a-practise/1129 2. 思路: 题意:给出用户查询过的编号,输出用户查询过的最多次数的前K个。 思路: 结构体排序题。 不过这次要用集合比较好。 set有自动排序功能。所以我们按照题意对set的比较运算符重载,让set自动排序。 用户的每一次查询,我们就直接输出set的前k个就行了。 然

坚不萌 361

【PAT】A1129 Recommendation System【排序】

Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user’s preference by the number of time...

elegant coder 497

PAT A1129(怪自己笨,别怪sort不好用)

题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805348471259136 测试用例3,4超时。借鉴学习了别人的代码(偷瞄一眼),发现我每次增加次数的时候,都要遍历,所以我改进成时间复杂度为O(1)的办法,即不用结构体记录次数,用散列表记录次数。改完后发现,我去,还是超时,真是坑的爆炸。现在的时间,主要浪费在排...

我好像在哪儿见过你 489

PAT甲级——A1129 Recommendation System【25】

Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user's preference by the number of...

weixin_30632089的博客 164

PAT甲级A1129 Recommendation System (25 分)

Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user's preference by the number of time...

vir_lee的博客 256

PAT A 1129 AC 代码

为了不超时,逻辑稍微有点绕 细节逻辑写在注释里了 #include<iostream> #include<vector> #include<set> #include<algorithm> using namespace std; struct node{ int num; int Ct=0; int pos; }; vector<node> query; set<int> s; bool cmp(const node a,

maxleo928的博客 87

PAT A 1128 1129 1130 1131

1128 8皇后问题:任意两个皇后不能在同一个竖线、横线、斜线上 判断是否是N皇后成立 #include&lt;stdio.h&gt; #include&lt;math.h&gt; int main(){ int k; scanf("%d", &amp;k); for(int i=0;i&lt;k;i++){ int n; scanf(...

大美mixer的博客 184
上一篇: PAT a1130
下一篇: PAT a1128
CSlerner
博客等级 码龄9年 153粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值