/** * read core attribute */ void mips32_cfg_init(void) { rt_uint16_t val; rt_uint32_t cp0_config1; cp0_config1 = read_c0_config(); if (cp0_config1 & 0x80000000) { cp0_config1 = read_c0_config1(); val = (cp0_config1 & (7 << 22)) >> 22; g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); val = (cp0_config1 & (7 << 19)) >> 19; g_mips_core.icache_line_size = 2 * m_pow(2, val); val = (cp0_config1 & (7 << 16)) >> 16; g_mips_core.icache_ways = val + 1; val = (cp0_config1 & (7 << 13)) >> 13; g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); val = (cp0_config1 & (7 << 10)) >> 10; g_mips_core.dcache_line_size = 2 * m_pow(2, val); val = (cp0_config1 & (7 << 7)) >> 7; g_mips_core.dcache_ways = val + 1; val = (cp0_config1 & (0x3F << 25)) >> 25; g_mips_core.max_tlb_entries = val + 1; }
float solve(int coe,int mi) { float t = 0.0; int c=0; do { x=x-(m_pow(x,mi)-coe)/(mi*m_pow(x,mi-1)); t = m_pow(x,mi)-coe; t = t>0?t:-t; if((c++)>(1<<30)){printf("OUT OF RANGE\n");x=-1;break;} }while(t>error); return x; }
dig_uni fromRadToDigCode(ana_uni rad,dig_uni codeBitNum){ return rad/2/PI*m_pow(codeBitNum); }
int main () { ways = _tmp[0]; nways = _tmp[1]; freopen ("restore.in", "rt", stdin); freopen ("restore.out", "wt", stdout); scanf ("%d %d %d", &n, &m, &p); memset (ve, 0, sizeof ve); for (int i = 0; i < m; i++) { int a, b; scanf ("%d %d", &a, &b); add_edge (a - 1, b - 1); } scanf ("%d %d", &S, &t); S--; for (int i = 0; i < t; i++) scanf ("%d %d", &A[i], &B[i]); _bfs::bfs (S); for (int i = 0; i < n; i++) if (bi[i] == A[0]) nways[i] = 1; else nways[i] = 0; _swap (); B[0]--; int cur = (B[0] ? 0 : 1); matrix m; while (cur < t) { m_build (m, A[cur]); m_pow (m, B[cur]); m_apply (m); cur++; /* if (B[cur] <= 32) { for (int i = 0; i < B[cur]; i++) { for (int j = 0; j < n; j++) if (ways[j]) for (edge* e = ve[j]; e; e = e->next) if (bi[e->b] == A[cur]) nways[e->b] = (nways [e->b] + ways[j]) % p; _swap (); } } else { for (int i = 0; i < 32; i++) { for (int j = 0; j < n; j++) if (ways[j]) for (edge* e = ve[j]; e; e = e->next) if (bi[e->b] == A[cur]) nways[e->b] = (nways [e->b] + ways[j]) % p; _swap (); } B[cur] -= 32; _cmp::compute (B[cur]); for (int i = 0; i < n; i++) nways[i] = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) nways[j] = (nways[j] + ways[i] * xways[i][j]) % p; } cur++;*/ } __int64 sum = 0; for (int i = 0; i < n; i++) sum = (sum + ways[i]) % p; printf ("%I64d", sum); return 0; }
ana_uni fromDigCodeToRad(dig_uni digCode,dig_uni codeBitNum){ return ana_uni(digCode)/m_pow(codeBitNum)*2*PI;//ana_uni() is import. }