POJ 2849 brainf*ck

BrainFuck 人肉编译规则 简介Brainfuck是一种极小化的计算机语言,它是由Urban Müller在1993年创建的。由于fuck在英语中是脏话,这种语言有时被称为brainf*ck或brainf**k,甚至被简称为BF。 也算是一个奇葩语言吧,不过好像没啥实际作用,因为太轻量了,只能用于表示简单的某些简短的字符串(推荐装逼表白使用吧,其它大概没啥卵用),解析规则还挺有意思的,好久没写博客了,记录一下上午研究成果. 阅读详情

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int cao[32768],pa[130000],stack[130000];
int p,ls;
void caonima(int v)
{
    v=cao[p]+v;
    if (v == -1)
        v=255;
    if (v == 256)
        v=0;
    cao[p]=v;
}
void caonimei(int v)
{
    v=v+p;
    if (v == -1)
        v=32767;
    if (v == 32768)
        v=0;
    p=v;
}
int main()
{
    int n,fuckall,lp,T,i,j,k,cnt;
    char tc,pro[130000];
    scanf("%d",&T);
    getchar();
    k=1;
    while (T--)
    {

        p=0;
        memset(cao,0,sizeof(cao));
        lp=0;
        while (1)
        {
            scanf("%c",&pro[lp]);
            lp++;
            if (pro[lp-1] == 'd' && pro[lp-2] == 'n' && pro[lp-3] == 'e')
            {
                pro[lp-3]='\0';
                lp-=3;
                break;
            }
        }
        printf("PROGRAM #%d:\n",k);
        k++;
        cnt=0;
        ls=0;
        for (i=0; i<lp; i++)
        {
            if (pro[i] == '[')
            {
                cnt++;
                stack[ls]=i;
                ls++;
            }
            if (pro[i] == ']' && cnt == 0)
            {
                cnt=-1;
                break;
            }
            else if (pro[i] == ']' && cnt != 0)
            {
                cnt--;
                pa[stack[ls-1]]=i;
                pa[i]=stack[ls-1];
                ls--;
            }
        }
        if (cnt != 0)
        {
            printf("COMPILE ERROR\n");
            continue;
        }
        for (i=0; i<lp; i++)
        {
            tc=pro[i];
            if (tc == '%')
            {
                while (pro[i] != '\n')
                {
                    pro[i]='f';
                    i++;
                }
            }
            if (tc == '+')
            {
                caonima(1);
            }
            else if (tc == '-')
            {
                caonima(-1);
            }
            else if (tc == '>')
            {
                caonimei(1);
            }
            else if (tc == '<')
            {
                caonimei(-1);
            }
            else if (tc == '.')
            {
                printf("%c",cao[p]);
            }
            else if (tc == '[')
            {
                if (cao[p] == 0)
                {
                    i=pa[i];
                }
            }
            else if (tc == ']')
            {
                if (cao[p] != 0)
                {
                    i=pa[i];
                }
            }

        }
        printf("\n");
    }
}


QT5.14.2+VS2019安装配置教程Windows QT5.14.2+VS2019安装使用教程Windows前言一. QT的下载与安装1. QT的下载2. QT的安装二. 配置Visual Studio编译器环境1. 扩展工具下载2. 扩展工具配置 前言 由于Visual Studio 的功能强大,很多开发人员比较熟悉使用,所以可以通过将QT配置到Visual Studio中进行开发。 一. QT的下载与安装 1. QT的下载 QT5.14.2下载地址 2. QT的安装 断开网络!断开网络!!断开网络!!! 安装QT之前,需要断开电脑的网络连接,这样就 阅读详情

相关推荐

直升机空气动力学基础--005翼型的升阻比和气动力矩

焦点与翼型有关,总升力矩可以视为附加升力与零升力迎角升力的合成,对于对称翼型,零升力力矩为0,附加升力就是总升力,其焦点就是其压力中心。对于对称翼型,零升力力矩为0,对于非对称翼型,零升力力矩存在,与不对称度成正比。对于不对称翼型,升力对焦点的力矩保持不变。

ygf666的博客 4133

最冷门的编程语言,Brainf*ck简介

[+>+>>+>>>> >+>>>>>+

weixin_46121540的博客 837

物联网低功耗广域网NB-IoT开发(一):初识NB-IoT

(二)NB-IoT的关键特性: (三)NB-IoT的应用场景: 二、NB-IOT介绍

weixin_49763156的博客 853

Brainf**k 程序设计

前一段时间听说了一门叫做“brainfuck”的编程语言,感觉很是神奇,就打算抽时间研究一套用这门语言做程序设计的方法。虽说纯属娱乐,但是还是感觉收获颇丰。 下文内容中,所有引用内容都会标明出处。其余绝大多数内容均来自个人“创意”,如有雷同纯属巧合。由于笔者水平有限,内容中如有不妥,请在评论区评论,我会尽快更正。

总理同学的编程尝试 2908

开源数显表

开源数显表,广泛应用于车床、铣床、磨床、镗床、火花机、线切割等。市面上此类液晶数显表多数都是基于此项目。 一、基本配置 硬件 主控:STM32F407VGT6 LCD:群创AT070TN92 显示驱动:RA8875 光栅尺:3 x 输入(X/Y/Z) 串口:1 x MAX3232 继电器:2 x 输出 存储:AT24C64 模拟输入:LM324C 电源:AC 220V 软件 工程版本:Keil 5 STM32库:V1.4.0 图形界面:uCGUI 多语言支持:中文、英文 二、项目文

m0_70934529的博客 435

八戒留档之宝塔部署edusoho

1.安装好基础的服务 2.上传你下载的代码到www/wwwroot文件3、配置网站 4.编辑创建的网站修改nginx文件 NGINX配置如下 server { listen 80; server_name 你的域名; root /www/wwwroot/项目文件名称/web/; location / { try_files $uri /app_dev.php$is_args$args; } ...

wolf23151269的博客 2541

BrainFuck——C实现BrainFuck解释器

首先介绍一下吊炸天的语言——BrainFuck Brainfuck是一种极小化的计算机语言,它是由Urban Müller在1993年创建的。由于fuck在英语中是脏话,这种语言有时被称为brainf*ck或brainf**k,甚至被简称为BF 这种语言基于一个简单的机器模型,除了指令,这个机器还包括:一个以字节为单位、被初始化为零的数组、一个指向该数组的指针(初始时指向数组的第一

九日王朝 1万+

读书笔记:深度学习入门-基于python的理论与实现(俗称鱼书)

终于从头到尾把鱼书看完啦,真的是非常入门,非常查漏补缺,对新手很友好,对有一定基础的人也非常不错。看完不复习等于没看,所以今天开始复盘,顺便写这篇读书笔记。希望分享给没看过这本书或者看过这本书的同僚们参考,欢迎大家指教。我将从第三章神经网络开始复习,前两章内容书里已经非常基础and清楚了。(会持续更新滴).........

博客而已 1万+

soj 1205. brainf*ck

题意: 一种叫做brainf*ck 的语言,只有七种操作符,+ - > 数据范围0~255(循环),地址范围0~32677(循环), + 当前地址的数据自增1 - 当前地址的数据自减1 >地址自增1 [ 如果当前地址的数据为0,向后跳直到遇到匹配的']' ] 如果当前地址的数据不为0,向前跳知道遇到匹配的'[' . 输出当前地址的数据(char) 当然还有注释符号%

jasison 434

FPGA DDR3实战(四):DDR地址映射自动化测试(1)—— 测试程序设计与代码逻辑

本文介绍了一种DDR地址映射自动化测试方案,旨在提高板卡调试效率。方案通过AXI4协议实现主从端通信,构建了包含地址控制器和测试数据生成器的模块化架构。测试程序支持突发传输、状态监控和错误检测,可灵活配置测试参数。采用状态机控制流程,先写入递增数据再读取比对,完成功能验证和性能评估。该方案可系统化验证DDR的正确性、稳定性和可靠性,相比传统手动测试显著提升效率。

FPGA_小田老师的博客 1978

Cesium功能集(十二):Cesium中流体仿真

【代码】Cesium功能集(十二):Cesium中流体仿真。

GIS肆月 602

用Java语言实现Brainf*ck语言解释器

花费一周时间,我用Java做出了Brainf*ck解释器!

wang2jun1pu3的博客 382

解决群晖NAS无法拉取docker镜像问题

在2024-06-01日以前,使用SSH登录后是可以直接拉取docker镜像的;但是之后当我们使用SSH登录上群晖NAS,使用【sudo -i】切换到超管拉取镜像会提示报错【error pulling image configuration: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/cf/cff6b68a194a672fd337d8728bfb252071012cce6

提供C#相关开发 、云计算、运维测试、网络安全相关技术分享与服务,有意向可联系。 2万+

史上最奇葩的5个编程语言,其指令更算计了奶牛、空格等

最难学编程语言有哪些?很多人都用过Java、C、C++之类的编程语言编写代码。再早几年,很多人会使用Pascal、Fortran、COBOL等编程。在学习这些语言的过程中,会遇到足够的挑战,让你抓狂。但是最终,当你投入足够的时间和精力之后,一切也变得顺利起来。但是,也的确有些难到极致的编程语言。这些语言被称为极品编程语言。创造它们的原因通常是为了测试编程语言设计的临界,或者只是一个玩笑。好消息是,它

Control Complexity 1445

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

BrainF*ck语言使用心得

++++++[-]++++++[-][>+>+[-]

Mr_Joer的博客 422

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

Sicily 1205. brainf*ck

1205. brainf*ck Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description brainf*ck is the ungodly creation of Urban Mller, whose goal was apparently to create a Turing-complet

Nightonke's Blog 615

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

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

ZOJ-2849

ZOJ-2849-Attack of Panda Virus Time Limit: 3 Seconds Memory Limit: 32768 KB In recent months, a computer virus spread across networks in China. The virus came with an ico

大咸鱼。。。 411

史上最奇葩的5种编程语言,有的甚至模拟奶牛

本文作者为 Deepak Karanth,主要介绍世上最怪异、最难用的5种编程语言。文章系国内 ITOM 管理平台 OneAPM 编译呈现。

wangpeng198688的专栏 4664

POJ 刷题顺序

POJ从简到难(按照AC数目排序)的列表如下,作为小弱的刷题

thestoryofsnow的专栏 31万+

【博客搬家】本博客已全面停止更新,新博客地址 plusplus7.com

新博客地址:http://www.plusplus7.com

仰望圣光的plusplus7 1532

CodeForces 268A Games

水题一枚。。。 #include #include #include using namespace std; int main() { int n,i,ans,j,cnt[200],a[200],b[200]; scanf("%d",&n); memset(cnt,0,sizeof(cnt)); for (i=0; i<n; i++) {

仰望圣光的plusplus7 1411

BNUOJ 3881 Jigsaw Puzzles

USACO Elite 2008 December Competition Silver 题意:给你一些正方形的拼图碎块,每个碎块有四个边,每边都有一个记号,分别是小写字母a-z。其中没有标记的边,也就是边界的边用'0'标记。题目给定一个矩阵,把这些碎块放进去,要求每个边相接的记号必须一样,边界上的边必须是'0'。 解法:DFS。这个操作起来还是挺麻烦的,做处理的时候要小心一些。

仰望圣光的plusplus7 966

SGU 249 Matrix

格雷码。。#include #include #include #include using namespace std; int grayCode[10000000]; int main() { int s,n,m,pn,pm,t,i,j; scanf("%d%d",&n,&m); s=pow(2,(n+m)); pn=pow(2,n); pm=p

仰望圣光的plusplus7 891

POJ 3856 deltree

模拟题。 deltree Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 58   Accepted: 33 Description You have just run out of disk space and decided to delete some

仰望圣光的plusplus7 811

SGU 111 Very simple problem

叫Very simple problem的通常都不简单。。。 此题就是让你求一个数的平方根取整。但是这个数特别大10^1000。所以不能(int)sqrt。。 查了一下解题报告,有两种方法。 第一种是模拟徒手开方,第二种是高精度+二分。 这里先整理徒手开方的解法。 (1)把被开方数(如22146436)从右向左每隔两位用撇号分开(如22’14’64’36); (2)从左边第一段(如

仰望圣光的plusplus7 791

POJ 1950 Dessert

给定一个n,求由1到n的数经过'+','-'或'.'三种运算后值为0的方法数。 并输出前20组答案,若不足20组,输出全部。 这题思路肯定是DFS,在处理搜索出来的式子时会有些麻烦。 #include #include #include using namespace std; int n,a[15],ans; int calc() { int i,t,cnt;

仰望圣光的plusplus7 728
上一篇: 【总结】2013年,再见ACM/ICPC
plusplus7
博客等级 码龄15年 59粉丝 173原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值