题目
题目:脉冲神经网络
代码
一、33分版本
# include <bits/stdc++.h>
using namespace std;
static unsigned long ne = 1 ;
const int M = 1000 ;
const int BM = 100000 ;
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) {
int temp_id = cid ( temp_in, temp_out) ;
trans[ temp_id] . arrive_time[ time+ trans[ temp_id] . D] = 1 ;
}
}
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) {
int r;
double v, u, a, b, c, d;
cin>> r>> v>> u