hihoCoder 1234 Fractal(找规律)

FastFlowLM:AMD NPU本地大模型部署实战指南 大语言模型本地部署正从GPU向端侧AI芯片演进,AMD NPU作为Ryzen AI处理器的核心加速单元,具备低功耗、高能效的端侧推理潜力。其XDNA架构并非简化GPU,而是专为INT4/FP16张量运算优化的固定功能加速器,但面临ROCm生态不成熟、KV缓存受限、量化适配失衡等工程瓶颈。FastFlowLM通过直连ROCm底层API、DMA驱动的流式KV缓存、FP16权重+INT8激活协同量化等关键技术,实现NPU硬件资源的深度榨取。它适用于锐龙7040/8040系列笔记本及AI PC商用场景,在无外接电源 阅读详情

题目链接:

http://hihocoder.com/problemset/problem/1234

解题思路:

题目大意:

以A0(0,0), B0(0,1), C0(1,1), D0(1,0)四个点组成的正方形,每次取边A0B0, B0C0, C0D0, D0A0的中点相连,能得到新的正方形,按

此操作1000次,可以得到与题目所给的图片一样,现在在x为0~0.5之间作一条垂线x=k,问你该垂线与标识有几个交点,当有无穷

个交点时,直接输出"-1"

算法思想:

仔细看看,就能发现:每条垂直边的横坐标都等于(前一条垂直边的横坐标+0.5)/2,然后根据:如果垂线与小正方形的边重合,那么

就输出“-1”;其他,越往内,每经过一个具有垂直于x轴的边的正方形,就会增加4个交点。最后利用lower_bound求解即可。。。

AC代码:

#include <iostream>
#include <cstdio>
using namespace std;

double a[1005];

void init(){
    double x = 0.5;
    for(int i = 0; i <= 1000; i++){
        a[i] = 0.5-x;
        x *= 0.5;
    }
}

int main(){
    int T;
    init();
    scanf("%d",&T);
    while(T--){
        double k;
        scanf("%lf",&k);
        int pos = lower_bound(a,a+505,k) - a;
        if(a[pos] == k)
            puts("-1");
        else
            printf("%d\n",4*pos);
    }
    return 0;
}


第五章-AllData集成DataSophon作为数据平台功能 🔥🔥 AllData大数据产品是可定义数据中台,以数据平台为底座,以数据中台为桥梁,以机器学习平台为中层框架,以大模型应用为上游产品,提供全链路数字化解决方案。全新会员商业版 X 微信群:https://docs.qq.com/doc/DVHlkSEtvVXVCdEFo 阅读详情

相关推荐

如何产生ATPG IR-drop分析波形文件(DFT)

摘要:本文介绍了生成VCD波形的流程与要求,主要用于后端进行IR-drop分析。生成过程分为ATPG shift和speed ATPG capture两部分,分别对应不同的输入要求、模式设置和仿真参数。

murphyrong的博客 887

hihocoder #1234 : Fractal 北京赛区(2015)网络赛 (找规律)

#1234 : Fractal 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 This is the logo of PKUACM 2016. More specifically, the logo is generated as follows: 1. Put four points A0(0,0), B0

LzyRapX 874

【backtrader保姆级教学】投资组合回测

method1:探索投资组合的最有方案,使用蒙特卡洛模拟Markowitz模型。# 提取最小波动组合对应的权重, 并转换成Numpy数组。# 绘制收益-标准差的散点图,并用颜色描绘夏普比率。# 在收益-风险散点图中突出风险最小的点。:param any_day: 任意日期。# 将该点坐标显示在图中并保留四位小数。password = “替换密码”# 找到标准差最小数据的索引值。user = “替换账号”# 计算GMV投资组合收益。# 计算每项资产的夏普比率。# 设置无风险回报率为0。

weixin_38132951的博客 2327

hihoCoder1234 Fractal lower_bound水题

题目链接:http://hihocoder.com/problemset/problem/1234 题目大意:给以一个边长为1的正方形,以该正方形各边的中点为顶点做出一个小正方形,以此类推,画出1000个正方形,现在给出一条平行于y轴的直线x=k(k∈[ 0,0.5 ]),问x=k和上述图形有多少个交点。 分析:很明显,对于某一区间,其交点的个数是一样的,我们只需打出这些所有可

AC_Gibson的专栏 571

GPOPSII 对控制量变化率进行约束,避免控制量振荡

在这篇文章中,在GPOPSII中通过对控制量变化的约束,优化求解得到更平滑的控制量曲线,更符合真实控制约束。

Dannyfomer的博客 1878

手把手教你用Python+Playwright实现抖音/B站/视频号三平台自动上传(附完整配置流程)

本文详细介绍了如何使用Python和Playwright构建一个多平台视频自动化上传系统,涵盖抖音、B站和视频号三大平台。文章从环境搭建、身份验证持久化、平台特异性上传引擎设计到任务调度与错误处理,提供了完整的配置流程和实战代码,帮助开发者实现高效、稳定的批量上传功能。

weixin_29294975的博客 1183

hihoCoder #1234 : Fractal(数学简单题)

时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 This is the logo of PKUACM 2016. More specifically, the logo is generated as follows: 1. Put four points A0(0,0), B0(0,1), C0(1,1), D0(1,0) on a...

dielucuan8830的博客 103

保姆级避坑指南:Mid-360雷达到手后,用livox_ros_driver2从接线到出点云的完整流程

本文提供Mid-360雷达到手后的完整使用指南,涵盖从硬件接线、网络配置到livox_ros_driver2驱动的安装与调试,帮助用户避开常见陷阱,实现点云数据的稳定输出与可视化。重点解析了配置文件的参数设置和点云格式选择,确保用户能够高效部署和使用Mid-360雷达。

weixin_30733003的博客 499

FZU 1078 计算循环冗余码(基础题+模拟)

计算循环冗余码 Description 计算机网络中采用循环冗余码来校验数据的正确性。其原理是:发送方计算出待发送的二进制数据的循环冗余码,并随同原数据一起发送到接收方;接收方通过重新计算接收到的数据的循环冗余码,并和收到的循环冗余码进行比较,如果两者相同则可判定所收到的数据是正确的,否则说明数据是错误的。其中计算二进制数据的循环冗余码的计算过程如下: 1.协议事先约定一个二

piaocoder 5441

揭秘大数据领域数据产品的开发流程

随着企业数字化转型加速,数据产品已成为驱动业务增长的核心载体。不同于传统软件产品,数据产品以数据为核心生产要素,通过数据采集、处理、分析与可视化,为用户提供决策支持或智能化服务。本文旨在系统性拆解数据产品开发的全生命周期,涵盖需求分析、数据工程、模型构建、产品设计、上线运维等关键环节,揭示各阶段的技术原理、实施路径与最佳实践,帮助技术团队与产品团队建立标准化开发流程。核心概念:定义数据产品本质,对比传统软件产品差异技术体系:拆解数据采集、处理、建模、可视化的技术栈与算法原理。

AI Agent Harness Engineering 489

5、快速入门

点击启动实例按钮,并设计一个business key,每个实例会有一个business key, 业务主键,也相当于一个流程实例唯一key,一般会与一次业务强相关,比如一个订单号 ,此处取为shopping_1;付款程序完成后会流转到物流发货任务,此时java工程的相应订阅会收到任务,并进入断点,且读到到toWhere变量。单击shopping可以进入实时流程图的执行图,此时流程流转到第一个任务,需要业务系统完成此任务,并通知引擎。添加类,分别订阅流程中的加入购物车任务和物流发货任务。

leyoliu的博客 3513

hihoCoder 1139 二分·二分答案

#include using namespace std; struct edge{ int x,w; }; int n,m,k,t; vector v[10005]; int vis[10005]; bool bfs(int dis){ memset(vis,0,sizeof(vis)); queue q; q.push(1); while(!q.e

piaocoder 1274

智算中心建设项目初步设计方案

本项目面向区级政府、智算中心及文旅从业者,聚焦某区智算中心一期建设,响应数字经济与智慧城市建设政策,推动文旅产业升级。遵循统筹规划、数据驱动原则,目标打造智慧文旅样板。建设内容涵盖云网数据底座(以租代建)、数据中台(全生命周期管理)、智慧文旅平台(含“一机游”电商)及气象监测等配套,采用前后端架构与低代码开发,强化三级等保与纵深防御,实现安全可控。方案融合多类资源目录,提供从设计到运营的完整技术支撑,助力区域智算与文旅深度融合。

cdfunlove的博客 121

Codeforces 488A Giga Tower

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5104  解题思路:BestCoder官方题解:

piaocoder 1031

深度学习工具包 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")

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

FZU 1055 赋值问题(细节决定成败)

赋值问题 Description 在很多程序设计语言中,忘记给变量赋初值的错误常令人头疼。请编程求出含N(0≤N≤100)行的程序段运行以后有哪些变量中有确定的值。 在下面的问题中,最开始仅有变量a中有确定的值。变量为单个小写字母,每行恰好有三个字符,中间一个是赋值运算符'='。 Input 输入有多组数据,每组数据的第一行有一个整数N,表示程序段的行数

piaocoder 1005

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

hdu 5347 MZL's chemistry

orz高中生。。。高中的知识我现在都差不多都还给老师了。。。直接百度吧。。。 序号 符号 名称 第一电离能 第二电离能 第三电离能 第四电离能 第五电离能 第六电离能 第七电离能 第八电离能 第九电离能 第十电离能 1 H 氢 1312          

piaocoder 970

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Codeforces 567A Lineland Mail

题目链接: http://codeforces.com/problemset/problem/567/A 官方题解: One can notice that the maximum cost of sending a letter from i'th city is equal to maximum of distances from i'th city to first cit

piaocoder 946

计蒜客 搜狗输入法的分词算法(模拟 字符串)

搜狗输入法的分词算法 搜狗输入法最近的用户输入中出现了一种新的输入模式,形如 “0k1234567”,搜狗的工程师发现这一模式后了解到,这是一种新被提出的对于十五进制数字的标记模式,其中 “0k” 是标记进制为15的前缀标记,之后的部分 “1234567” 是实际的十五进制的数字串。 在发现这一标记模式后,搜狗的工程师开始尝试在已有的分词算法上进一步加入对于十五进制数字串的处理,把网页

piaocoder 900

Codeforces 569A Music

题目链接: http://codeforces.com/problemset/problem/569/A 解题思路: 坑人的英语题,读了半天,都没懂他的意思。。。结果看了题解,才知道 For q seconds of real time the Internet allows you to download q - 1 seconds of the track.这句话是q:(q-

piaocoder 815

HDU1121——Complete the Sequence

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1121 题目大意:给你一串有规律的数,让你写出后面C个。 别人都说是差分,但我是根据直觉来做这道题的,因为以前学过等差数列和等比数列,和这有差不多的性质,结果真的一样。就这么递推出来了。其实当你看到第三组样例时,也同样能找出答案。     0 1 2 3 4 5 6 7 8 9   ------

piaocoder 778

HDU 5112 A Curious Matt

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112 解题思路: 求出最大的速度。 AC代码: #include #include #include #include using namespace std; struct node { int t,s; double v; }no[10010]; boo

piaocoder 773

HDU5122 K.Bro Sorting

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112 解题思路: 坑死了,想了各种排序,结果发现只需要:对于每一个数只要后面的数有比它小就要更换一次,然后sum++就行了。 AC代码: #include #include using namespace std; int a[1000010]; int main() {

piaocoder 768

POJ2215 Parliament

题目链接:http://poj.org/problem?id=2215 解题思路: 给你一个矩阵,然后让你求矩阵中任意矩形范围内的和。(英语不好,果然是硬伤!!!) AC代码:#include #include using namespace std; int maze[1010][1010]; int main() { int T; scanf("%d",&

piaocoder 740

Codeforces 570A Elections

题目链接: http://codeforces.com/problemset/problem/570/A 解题思路: We need to determine choice for each city. Then sum it for each candidate and determine the winner. O(n * m) AC代码: #include #i

piaocoder 726

Codeforces 495 A. Digital Counterr && Codeforces Round #282 (Div. 2)

题目链接:http://codeforces.com/problemset/problem/495/A 解题思路:Codeforces官方题解: For each digit x you can count the number of digits y that because of some broken sticks x is shown instead of y by

piaocoder 689
上一篇: hihoCoder 1233 Boxes(状态压缩)
下一篇: hdu 5461 Largest Point
yphacker
博客等级 码龄12年 199粉丝 540原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址