【CCF-CSP】 202109-3 脉冲神经网络

题目

题目:脉冲神经网络

代码

一、33分版本

#include<bits/stdc++.h>
using namespace std;
static unsigned long ne = 1;
const int M = 1000;
const int BM = 100000;

/* RAND_MAX assumed to be 32767 */
int myrand(void) {
   
    ne = ne * 1103515245 + 12345;
    return((unsigned)(ne/65536) % 32768);
}

typedef struct nerve{
   
    int cnt;
    double I,v,u,a,b,c,d;
}nerve;
nerve nerves[M];

typedef struct tran{
   
    int out;
    int arrive_time[BM];
    double w;
    int D;
}tran;
map<int,tran> trans;
map<int,set<int> > relation;

typedef struct pulse{
   
    int id,r;
}pulse;
map<int,pulse> pulses;

void update(nerve &ner, double t){
   
    double v = ner.v,u = ner.u;
    ner.v = v + t*(0.04*v*v+5*v+140-u) + ner.I;
    ner.u = u+t*ner.a*(ner.b*v-u);

}

int cid(int in,int out){
   
    return in*M+out;
}

void make_pulse(int in,int time){
   
    int temp_in = in;
    set<int> outs = relation[temp_in];
    for(auto temp_out:outs){
   
        //cout<<"temp_out:"<<temp_out<<endl;
        int temp_id = cid(temp_in,temp_out);
        trans[temp_id].arrive_time[time+trans[temp_id].D] = 1;
        //cout<<"temp_id£»"<<temp_id<<" time:"<<i<<" D:"<<trans[temp_id].D<<endl;
    }
}



int main()
{
   
    int N,S,P,T;
    cin>>N>>S>>P>>T;
    double t;cin>>t;
    int temp_N = N;
    int i=0;
    while(temp_N){
   
        //cout<<"test0!"<<endl;
        int r;
        double v,u,a,b,c,d;
        cin>>r>>v>>u
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值