text
stringlengths
59
71.4k
///////////////////////////////////////////////////////////////////// //// //// //// simple_spi ('HC11 compatible) testbench //// //// //// //// Author: Richard Herveille ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:08:07 06/04/2015 // Design Name: keymem // Module Name: F:/Projects/Xilinx/Rijndael/test_memkey.v // Project Name: Rijndael // Target Device: // Tool...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sq = sqrt(n); if (n % sq == 0) { cout << sq << << n / sq; } else { int i = 0; while (++i) { if (n % (sq - i) == 0) { cout << sq - i << << n / (sq - i); break; ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// wasca_mm_interconnect_0_avalon_st_adapter_004.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 18.1 646 `timescale 1 ps / 1 ps module wasca_mm_interconnect_0_avalon_st_adapter_004 #( parameter inBits...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software...
#include <bits/stdc++.h> using namespace std; const long long N = (1LL << 22) + 2; long long n, m; long long a[N]; bool vis[2][N]; void dfs(long long k, long long cur) { if (vis[cur][k]) return; vis[cur][k] = 1; if (cur == 1) return dfs(k, cur ^ 1); for (long long i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); pair<int, int> home, uni; cin >> home.first >> home.second >> uni.first >> uni.second; int count; cin >> count; int solution = 0; int64_t a, b, c; for (int i = 0; i < count; i++) { cin >> a ...
#include <bits/stdc++.h> int main() { int len, i, l = 0, r = 0, u = 0, d = 0, dif1, dif2; scanf( %d , &len); char str[101]; scanf( %s , str); for (i = 0; i < len; i++) { if (str[i] == L ) l++; else if (str[i] == R ) r++; else if (str[i] == U ) u++; ...
// Copyright (c) 2014 CERN // Maciej Suminski <> // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // any late...
// File: ./ex-target/DotProduct.v // Generated by MyHDL 1.0dev // Date: Tue Oct 6 16:32:07 2015 `timescale 1ns/10ps module DotProduct ( y, y_da_vec, y_db_vec, a_vec, b_vec ); // Vector dot product and derivative model using fixbv type. // // :param y: return dot(a_vec, b_vec) as fixbv // :param...
/* * Copyright (c) 2000 Stephen Williams () * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * ...
// This file has been automatically generated by goFB and should not be edited by hand // Compiler written by Hammond Pearce and available at github.com/kiwih/goFB // Verilog support is EXPERIMENTAL ONLY // This file represents the Basic Function Block for VVI_LRI //defines for state names used internally `define STA...
#include <bits/stdc++.h> using namespace std; const int MAX = 303; const int MOD = 1e9 + 7; long long ncr[MAX][MAX]; map<int, int> cnt; int tot[MAX]; long long dp[MAX][MAX]; vector<int> fin; int get(int a) { int ans = 1; for (int i = 2; (i * i) <= a; i++) { int k = 0; while ((a % i...
#include <bits/stdc++.h> using namespace std; int a[40000005]; void oku() { int n; cin >> n; for (int i = 0; i < n; i++) a[i] = i; int l, k; for (k = 2, l = 0; k <= n; k++, l++) { int r = (n - 1) / k; a[n + l] = a[r * k + l]; for (; r > 0; r--) { a[r * k + l] = a[(r -...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; template <typename T> T gcd(T a, T b) { T c; while (b) { c = b; b = a % b; a = c; } return a; } template <typename T> T powmod(T a, T b) { T res = 1; a %= mod; while (b) { if (b...
#include <bits/stdc++.h> int main() { int i; for (i = 0; i < 10; i++) { printf( ??%d>>%d?? n , i, i); } printf( ??>>? n ); for (i = 0; i < 9; i++) { printf( %d?<>%d n , i, i + 1); } printf( 9?>>?0 n?<>1 n>>?? n ); }
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { string s, test = hello ; int c = 0; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == test[c]) { c++; } if (c == 5) { break; } } if (c == 5) { cout << YES << endl; } els...
`timescale 1ns/1ns //----------------------------------------------------------------------------- // Copyright (C) 2009 OutputLogic.com // This source file may be used and distributed without restriction // provided that this copyright statement is not removed from the file // and that any derivative work contains the...
#include <bits/stdc++.h> using namespace std; bool judge(int x) { for (int i = 2; i * i <= x; i++) { if (x % i == 0) return false; } return true; } int main() { int n; scanf( %d , &n); if (judge(n)) { printf( 1 n ); return 0; } if (n % 2) { if (judge(n - 2...
`timescale 1ns/1ps `include "output/vlog_constants.v" `include "../common/wishbone_test_master.v" `define FIFO_FULL 16 `define FIFO_EMPTY 17 module main; reg tsf_wr_req = 0; wire tsf_wr_full; wire tsf_wr_empty; wire [7:0] tsf_wr_usedw; reg [27:0] tsf_val_r; reg [3:0] tsf_val_f; reg [...
/***************************************************************************** * File : processing_system7_bfm_v2_0_arb_rd_4.v * * Date : 2012-11 * * Description : Module that arbitrates between 4 read requests from 4 ports. * *****************************************************************************/ module...
////////////////////////////////////////////////////////////////////// //// //// //// spi_shift.v //// //// //// //// This file is part of the SPI I...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, i, e, f, g, n, m, k, l, r; long long go(long long x) { k = 1; n = 0; m = 0; for (long long i = 1;; i++) { if (x <= 0) return ((m * (m + 1)) % 1000000007 + (n * n) % 1000000007) % 1000000007; if (i % 2 == 1) { ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:42:39 05/17/2015 // Design Name: clock_divider // Module Name: E:/Workspaces/Xilinx/processor/test_clock_divider.v // Project Name: processor // Target ...
#include <bits/stdc++.h> using namespace std; int main() { long long m, n, q = 998244853, sum = 1, a = 1, b = 1, r = 0, x = 208513042, y, z; cin >> n >> m; if (n == 0) { cout << 0; return 0; } if (m == 0) { cout << n; return 0; } for (long long...
#include <bits/stdc++.h> const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; const long long MOD = 1000000009; const int MAXM = 100010; int m; long long pow_mod[MAXM]; int X[MAXM], Y[MAXM]; map<pair<int, int>, int> ma; set<int> S; set<int> up[MAXM], down[MAXM]; v...
#include <bits/stdc++.h> using namespace std; map<long long, int> cont; int n; int ans; int main() { while (~scanf( %d , &n)) { int a; long long num = 0; for (int i = 1; i <= n; i++) { scanf( %d , &a); num += a; ans = max(ans, ++cont[num]); } printf( %...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Wed Sep 27 18:05:22 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
// ================================================================== // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< // ------------------------------------------------------------------ // Copyright (c) 2006-2011 by Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // --------...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
`timescale 1 ns / 1 ps module pmod_io_switch_v1_0 # ( // Users to add parameters here // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Slave Bus Interface S00_AXI parameter integer C_S00_AXI_DATA_WIDTH = 32, parameter integer C_S00_AXI_ADDR_WIDTH = 4 ) (...
/* Copyright (c) 2015 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
#include <bits/stdc++.h> using namespace std; const int N = 500005, mod = 1000000007; long long int a, b, c, d, e, f, g, h[N], arr[N]; string s; vector<long long int> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> a; long long int ans = 0, tek = 0...
// HERE IS THE TEST CASE module bt (/*AUTOARG*/ // Outputs out, // Inputs in ); input [7:0] in; output [7:0] out; wire [7:0] out = ~in; endmodule // bottm module top (/*AUTOARG*/ // Outputs outgo, // Inputs ...
`timescale 1ns/1ns module sum_test; reg clk; wire [10:0] s; initial begin clk = 0; forever #10 clk = ~clk; end sum #(5, 8) sum (clk, {8'd10,8'd20,8'd30,8'd40,8'd50}, s); initial begin $display("Starting..."); repeat (50) @(posedge clk); $display("sum = %d",s); i...
///////////////////////////////////////////////////////////////////////// // Copyright (c) 2008 Xilinx, Inc. All rights reserved. // // XILINX CONFIDENTIAL PROPERTY // This document contains proprietary information which is // protected by copyright. All rights are reserved. This notice ...
#include <bits/stdc++.h> using namespace std; long long ans = 0; int n, u, r; vector<int> b, k; vector<int> p; void exec(vector<int> a, int type, int count) { if (count < u) { if (type == 0) { for (int i = 0; i < n; ++i) a[i] = a[i] ^ b[i]; exec(a, 1, count + 1); } else { ...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; inline int add(int a, int b, int m = 1000000007) { a += b; if (a >= m) a -= m; return a; } inline int mul(int a, int b, int m = 1000000007) { return (int)(((long long)a * (long long)b) % m); } inline int norm(int x, int m = 1000000007) { if (...
#include <bits/stdc++.h> using namespace std; int main() { int x, y, a, b, c, num = 0; scanf( %d%d , &x, &y); a = b = c = y; while (a < x || b < x || c < x) { if (a <= b && a <= c) a = b + c - 1; else if (b <= a && b <= c) b = a + c - 1; else c = a + b - 1; ...
`define bsg_dff_en_macro(bits,womp) \ if (harden_p && width_p==bits && (strength_p==womp)) \ begin: macro \ bsg_rp_tsmc_40_EDFD``womp``BWP_b``bits dff(.i0(data_i) \ ...
#include <bits/stdc++.h> using namespace std; const long long UNDEF = -1; const long long INF = 1e18; template <typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; } template <typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; ...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin...
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n, p; scanf( %d , &n); scanf( %d , &p); vector<pair<int, int> > ans; int edges = 2 * n + p; for (int i = int(1); i <= int(n); i++) { for (int j = int(i + 1); j...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 100, INF = 1e9; struct edge { long long to, cost, id; }; vector<edge> g[N]; long long d[N], cost[N], path[N], used[N]; pair<long long, long long> from[N]; long long n, m; void bfs() { fill(d, d + n, INF); d[0] = 0; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module ddr3_dma( input clk, input rst, //Write Side input write_enable, input [63:0] write_addr, input write_addr_inc, input ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; vector<bool> visited; vector<vector<int> > adj; void dfs(int node, long long &s0, long long &s1, int mod) { if (mod == 0) s0++; else s1++; visited[node] = true; for (int i = 0; i < adj[node].size(); i++) { if (!visited[adj[node][i]]...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const long long oo = 1e18; const long long mod = 1e9 + 7; const int INF = 1 << 30; vector<pair<pair<int, long long>, int>> adj[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0); int n, m, ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(0) * 2; const double EPS = 1e-8; const long long MOD = 1e9 + 7; const int MAXN = 1e5 + 5; const int oo = 1e9; const double foo = 1e30; template <class T> int getbit(T s, int i) { return (s >> i) & 1; } template <class T> T ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } long long expr(long long n, long long e) { if (e == 0) return 1; if (e & 1) { return n * expr(n, e ^ 1); } else return expr(n, e ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); long long int mx = n * n; for (int i = 1, j = mx; i < j; i++, j--) { cout << i << << j << endl; } }
#include <bits/stdc++.h> using namespace std; struct { int begin, end; } P1[60], P2[60]; int main() { int num1, num2, first, last; scanf( %d %d %d %d , &num1, &num2, &first, &last); int ans = 0; for (int i = 1; i <= num1; i++) scanf( %d %d , &P1[i].begin, &P1[i].end); for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; int a[1000004]; int main() { int n, x; long long sum; int cnt; while (scanf( %d , &n) == 1) { sum = 0LL; cnt = 0; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); if (a[i] % 2 == 1) cnt++; sum += a[i]; ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int n, a[100100], m, x, rs = 1e9; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 1; i <= m; i++) cin >> x, a[x]++; for (int i = 1; i <= n; i++) rs = min(rs, a[i]); ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// File ../../vhdl/src/decoder.vhd translated with vhd2vl v2.5 VHDL to Verilog RTL translator // vhd2vl settings: // * Verilog Module Declaration Style: 2001 // vhd2vl is Free (libre) Software: // Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd // http://www.ocean-logic.com // Modification...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
#include <bits/stdc++.h> using namespace std; const int inf = ~0U >> 1; const long long INF = (long long)1e18; const double pi = acos(-1.0); template <class T> inline T sqr(T a) { return a * a; } template <class T> inline T min(T a, T b, T c) { return min(min(a, b), c); } template <class T...
`timescale 1ns/1ps /*************************************************************************** Name: Date: 7/11/2016 Founction: Send out capture value Note: ****************************************************************************/ module captuer_tx( clk,rst_n,tx_start,capture_ready,periodcounter,dutycyclecounter,...
#include <bits/stdc++.h> using namespace std; int n; vector<int> Left; vector<int> Right; map<pair<int, int>, int> excep; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(); cin >> n; for (int i = 0; i < n; i++) { int l, r; cin >> l >> r; Left.push_back(l); ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12/13/2015 09:44:53 AM // Design Name: // Module Name: SD_Card_Interface // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int N = 1e7 + 5; const long long INF = 9e18; const int M = 1e5 + 5; map<long long, vector<int> > f; long long p[N], ans1[M], a[M]; void solve() { for (int i = 2; i <= N; ++i) { if (i % 2 == 0) { p[i] = 2; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; vector<int> g[N]; void dfs(int u, vector<int>& dep, int par = -1, int h = 0) { dep[u] = h; for (int v : g[u]) { if (v == par) continue; dfs(v, dep, u, h + 1); } } int main() { ios_base::sync_with_stdio(false); ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long nb, ns, nc, pb, ps, pc, ab, as, ac, money; bool solve(long long k) { long long cb = k * ab, cs = k * as, cc = k * ac; long long cost = 0; cost += max(cb - nb, 0LL) * pb; cost += max(cs - ns, 0LL) * ps; cost += max(cc - nc, 0LL) * pc; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> int main() { long long int t, i = 0; long long ans = 0; scanf( %lld , &t); for (i = 0; i < t; i++) { long long int n; scanf( %lld , &n); ans = ans + i * (n - 1) + n; } printf( %lld n , ans); return 0; }
#include <bits/stdc++.h> using namespace std; class UFDS { public: vector<int> p, rank; int count = 0; UFDS(int n) { p.resize(n); rank.resize(n); for (int i = 0; i < n; i++) p[i] = i; count = n; } int getParent(int i) { return (p[i] == i) ? i : (p[i] = getParent(p[i]))...
`timescale 1ps/1ps //---------------------------------------------------------------------------- // "Output Output Phase Duty Pk-to-Pk Phase" // "Clock Freq (MHz) (degrees) Cycle (%) Jitter (ps) Error (ps)" //---------------------------------------------------------------------------- // CL...
#include <bits/stdc++.h> using namespace std; int main() { int a[110][110]; int n, i, j; long long s = 0; cin >> n; if (n == 1) { cin >> i; cout << i; return 0; } for (i = 0; i < n; ++i) for (j = 0; j < n; ++j) { cin >> a[i][j]; if (i == j) s += a[...
#include <bits/stdc++.h> const int maxn = 2005; const int inf = 1e9; using namespace std; vector<pair<int, int>> G[maxn]; vector<int> C[maxn], v; bool critical[maxn * maxn]; vector<int> seen, sum, col, depth, up; void dfs(int node, int ind) { seen[node] = 1; int minFromSons = inf; up[node] =...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_impctl_dtl_uprcn.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribu...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:21:59 11/06/2014 // Design Name: one_bit_adder_gate // Module Name: /home/varun/Desktop/eld/ass9/fouraddergate/one_bit_adder_fixture.v // Project Name: fouradderg...
#include <bits/stdc++.h> using namespace std; long long n, m, len; long long a, b, c, l; void solve() { long long tot = ((l + 3) * (l + 2) * (l + 1)) / 6; long long i; for (i = 0; i <= l; i++) { long long x = min(a - b - c + i, l - i); if (x < 0) continue; tot -= ((x + 2) * (x + 1)...
#include <bits/stdc++.h> using namespace std; int a[55]; long long int C[55][55]; double dp[55][55][55]; void precompute(int N) { for (int i = 0; i <= N; ++i) C[i][0] = 1; for (int i = 1; i <= N; ++i) for (int j = 1; j <= i; ++j) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; } double func(int n, ...
#include <bits/stdc++.h> using namespace std; int n, m, c[105]; int sum[105][10005], h[105][10005], f[105][10005]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %d , &c[i]); sum[i][0] = 0; for (int j = 1; j <= c[i]; j++) { int x; scanf( %d , ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1100010; const double pai = acos(-1.0); char s[maxn], t[maxn]; int n, m, a[maxn], b[maxn], ans[maxn], fa[maxn][6], rev[maxn], bin[1100010]; struct node { double a, b; node(double t0 = 0.0, double t1 = 0.0) { a = t0; b = t1; ...
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=10 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" clk1_divide_by=5 clk1_duty_cycle=50 clk1_multiply_by=1 clk1_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_device_...
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; int main() { int x; int a[2] = {0}; char c; while (scanf( %c , &c) != -1) { a[c - x ]++; } if (a[0] > a[1]) { x = a[0] - a[1]; for (int i = 0; i < x; i++) { printf( %c , x ); } printf( n ); } else { ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//Legal Notice: (C)2017 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5, oo = 0x3f3f3f3f; const long long M = 1e12 + 105; int dx[] = {1, 0, -1, 0}; int dy[] = {0, -1, 0, 1}; int main() { int c, r, ans = 0; scanf( %d %d , &r, &c); char second[r][c]; for (int i = 0; i < r; i++) scanf( %s , second[...
module main; reg [7:0] data_i; reg [2:0] addr; reg clk, rst, wr; reg [7:0] data_o, buff[0:7]; (* ivl_synthesis_on *) always @(posedge clk or posedge rst) begin if (rst) data_o <= 8'h0; else if (wr) begin buff[addr] <= data_i; data_o <= data_i; end else data_o <= buff[addr...
// SNES-Hook - A tiny 5V CPLD device to hijack reset on the SNES console // // Copyright (C) 2015 Evan Custodio // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the Lice...
#include <bits/stdc++.h> using namespace std; const int N = 100009; int n; long long a[N]; void print_ans(int l, int r, vector<long long>& v) { cout << l << << r << n ; for (long long vv : v) { cout << vv << ; } cout << n ; } int main() { ios_base::sync_with_stdio(fals...
// zhiyang ong // andrew mattheisen `timescale 1ns/10ps `include "control.h" module controltb; reg [0:31] instr; reg clk; wire [0:4] aluop, rrdaddra, rrdaddrb, rwraddrd; wire [0:2] ppp, regop, memop; wire [0:1] ww; wire [0:20] maddr; wire reginmuxop, aluinmuxop; wire [0:15] wbyteen;...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int INF = (int)2e9; const long long INFL = (long long)9e18; const int MAXINT = ((~0) ^ (1 << 31)); const long long MAXLL = ((~0) ^ ((long long)1 << 63)); template <class T> inline T pow2(T a) { return a * a; } template <class T> inline bool min...
#include <bits/stdc++.h> int n; double sum, tmp, ans; int main() { scanf( %d , &n); for (int div = 1; div <= n; div++) { scanf( %lf , &tmp); sum += tmp; if (sum / div > ans) ans = sum / div; } printf( %.20lf n , ans); }
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { char ch; bool flag = false; while (!isdigit(ch = getchar())) flag |= ch == - ; for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48)) ; if (flag) x = -x; } inline int input() { ...