text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void read(_T &f) { f = 0; _T fu = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) fu = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { f = (f << 3) + (f << 1) + (c & 15); ...
/* * 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> int main() { int n; while (scanf( %d , &n) != EOF) { int ans = 0; int sum = 0; while (n--) { int x; scanf( %d , &x); if (x == -1) { if (!sum) ans++; else sum--; } else sum += x; ...
module sopc( input clock, input reset ); wire rom_chip_enable ; wire [31:0] rom_read_address; wire [31:0] rom_read_data ; wire ram_chip_enable ; wire ram_read_enable ; wire [31:0] ram_read_address ; wire [31:0] ram_read_data ; wire ram_write_en...
#include <bits/stdc++.h> using namespace std; int main() { long long n, l, r; cin >> n; pair<pair<long long, long long>, long long> lr[n + 1]; for (long long i = 1; i <= n; i++) { cin >> lr[i].first.first >> lr[i].first.second; lr[i].second = i; } sort(lr + 1, lr + n + 1); fo...
#include <bits/stdc++.h> using namespace std; int n, i, j, k, s, a[50], b[50], c[50]; long long x; int main() { scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %I64d , &x); for (j = 0; (1ll << j) < x; j++) ; if ((1ll << j) == x) a[j]++; else b[j - 1]++;...
#include <bits/stdc++.h> using namespace std; void solve() { int n, h; cin >> n >> h; for (int i = 1; i < n; i++) printf( %.10f , h * sqrt(1. * i / n)); puts( ); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; t = 1; while (t--) { solv...
/** * 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...
//----------------------------------------------------------------- // // Filename : xlclockdriver.v // // Date : 6/29/2004 // // Description : Verilog description of a clock enable generator block. // This code is synthesizable. // // Assumptions : period >= 1 // // Mod. Histor...
/* * 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; long long int pow_mod(long long int a, long long int b) { long long int res = 1; while (b != 0) { if (b & 1) { res = (res * a) % 1000000007; } a = (a * a) % 1000000007; b /= 2; } return res; } void solve() { long l...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; const int N = 1005; vector<pair<int, int>> g[N], ans[N]; long long dist[N]; priority_queue<pair<int, int>> pq; bool vis[N]; void dijkstra(int s) { fill(dist, dist + N, 1LL << 61); memset(vis, false, sizeof(vis)); dist[s] = 0; pq.push({0, s}); ...
#include <bits/stdc++.h> int main(void) { unsigned int const max_skill_level = 100; unsigned int number_of_boys; unsigned int number_of_girls; unsigned int number_of_pairs = 0; std::vector<unsigned int> number_of_boys_with_each_skill_level( max_skill_level + 1, 0); std::vector<unsigned...
//====================================================================== // // Module Name: WHIRLPOOL_WCIPHER_MU // Description: Mu function of Whirlpool W-Cipher // // Language: Verilog-2001 // // Module Dependencies: none // // Developer: Saied H. Khayat // URL: https://github.com/saiedhk // ...
// File: clock.v // Generated by MyHDL 0.8.1 // Date: Sun May 15 22:24:35 2016 `timescale 500ms/1ms module clock ( clk, fast_clk, rst, en, sec, pm, io_seg, io_sel ); input clk; input fast_clk; input rst; input en; output [7:0] sec; reg [7:0] sec; output [17:0] pm; reg [17:0] pm; outpu...
#include <bits/stdc++.h> const long long MAX_N = 2e5 + 100; const long long MOD = 1e9 + 7; using namespace std; long long rm[MAX_N][20]; long long a[MAX_N]; map<int, int> last; long long ans; const long long c = (1ll << 50) - 1; long long ask(long long l, long long r) { long long len = r - l + 1; ...
#include <bits/stdc++.h> using namespace std; int main() { long long cnt = 0; int H; scanf( %d , &H); ; long long N; cin >> N; N--; long long n = 0; int d = 0; for (int h = (0); h < (H); h++) { long long msk = ((1LL) << (long long)(H - h - 1)); if (N & msk) { ...
#include <bits/stdc++.h> using namespace std; int a[100100], id[100100], t, Ans, ans[100100], n, i, vis[100100], j, k; int flag; vector<int> vec[100100]; bool cmp(int u, int v) { return a[u] < a[v]; } int main() { scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d , &a[i]); id[i] = i;...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3fffffff; const int SINF = 0x7fffffff; const long long LINF = 0x3fffffffffffffff; const long long SLINF = 0x7fffffffffffffff; const long double DINF = pow(2, 100); const int MAXN = 100007; const long double EPS = 1e-17; const long double ...
// nios_tester_audio_in_dma.v // This file was auto-generated from altera_msgdma_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 18.1 625 `timescale 1 ps / 1 ps module nios_tester_audio_in_dma ( output wire [25:0] mm_write_address, // mm_write....
#include <bits/stdc++.h> using namespace std; string sol; const int kBufferSize = 10000; int BufferInd = kBufferSize; char Buffer[kBufferSize]; void cit(int &n) { ((++BufferInd >= kBufferSize) ? (cin.read(Buffer, kBufferSize), BufferInd = 0) : (0)); for (; not((((Bu...
/** * 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...
/** * A Galois Linear Feedback Shift Register, uses the time to * finish calibration as the seed and then generates 16-bit * pseudo-random numbers. Re-seeds on user input for additional * randomness. * * More info: https://en.wikipedia.org/wiki/LFSR#Galois_LFSRs * * @author Robert Fotino, 2016 */ `include "de...
////////////////////////////////////////////////////////////////////// //// //// //// eth_outputcontrol.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; long long N; string S; long long sol; long long dim; long long e; long long last() { long long d = 1ll; long long n = 0ll; long long sz = (long long)(S.size()); int zero = 0; for (long long i = sz - 1; i >= sz - dim && i >= 0 && n < N; 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 law...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; scanf( %d%d%d%d , &a, &b, &c, &d); int a1 = abs(a - c) * 2; int b1 = abs(b - d) * 2; int ans = a1 + b1 + 4; if (a != c && b != d) printf( %d n , ans); else printf( %d n , ans + 2); return 0; }
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1p...
/** * 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 generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
//Legal Notice: (C)2018 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 static int INF = 1000000000; int t; string input; map<string, string> apa; int main() { scanf( %d , &t); string a, b; string v = void ; apa[v] = void ; while (t--) { cin >> input; if (input == typedef ) { cin >> a...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const long double PI = 3.1415926535898; const long long LLMAX = LLONG_MAX; int a[(int)2e5 + 5], b[(int)2e5 + 5], c[(int)2e5 + 5]; int n; vector<vector<int> > v((int)2e5 + 5); int type10 = 0; int type01 = 0; long long ans = 0; i...
`timescale 1ns/1ns `define SR 5'd12 `define CAUSE 5'd13 `define EPC 5'd14 `define PRID 5'd15 //ExcCode Values `define EC_INT 5'b00000 module cp0 (input clk, input rst, input [4:0] a1, input [4:0] a2, input [31:0] din, input [31:0] pc, ...
#include <bits/stdc++.h> using namespace std; long long fact[200010], cnt, cnt1[200010], cnt2[200010]; void precalc() { fact[0] = 1; for (int i = 1; i < 200010; i++) { fact[i] = (i * fact[i - 1]) % 1000000007; } } long long power(long long a, long long b, long long p) { if (b == 0) retur...
#include <bits/stdc++.h> using namespace std; const int N = 25, INF = 1e9 + 5; inline int read() { char c = getchar(); int x = 0, f = 1; while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(...
// // Generated by Bluespec Compiler, version 2018.10.beta1 (build e1df8052c, 2018-10-17) // // // // // Ports: // Name I/O size props // m_near_mem_io_addr_base O 64 const // m_near_mem_io_addr_size O 64 const // m_near_mem_io_addr_lim O 64 const // m_plic_addr_b...
#include <bits/stdc++.h> using namespace std; pair<int, int> Castle[100010]; int Index[100010]; int main() { int N; scanf( %d , &N); int Temp; for (int i = 1; i <= N; i++) { scanf( %d , &Temp); Castle[i] = make_pair(Temp, i); } sort(Castle + 1, Castle + N + 1); int Max = ...
/////////////////////////////////////////////////////////////// // sha1_round.v version 0.1 // // Primitive SHA1 Round // // Described in Stalling, page 284 // // Paul Hartke, , Copyright (c)2002 // // The information and description contained herein is the // property of Paul Hartke. // // Permission is g...
#include <bits/stdc++.h> using namespace std; const int INF = (1 << 30); const double eps = 1e-9; const int mod = 1000000007; const int MAXN = int(1e5) + 100; const int dx[] = {-1, +1, 0, 0}; const int dy[] = {0, 0, -1, +1}; int main() { ios::sync_with_stdio(false); int n; cin >> n; vect...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int pos[11][1111]; int gra[1111][1111]; int main() { int n, m; cin >> n >> m; int x; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cin >> x; pos[i][x - 1] = j; } } for (i...
#include <bits/stdc++.h> using namespace std; int main() { { ios_base::sync_with_stdio(false); cin.tie(0); }; int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<int> matching; vector<int> vis(3 * n + 1, 0); for (int i = 1; i <= m; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; string s; cin >> s; for (long long i = 1; i <= n; i++) if (!(n % i)) reverse(s.begin(), (s.begin() + i)); cout << s << n ; return 0; }
#include <bits/stdc++.h> using namespace std; int n, m; char my_array[50][50]; bool visited[50][50]; bool dfs(int i, int j, int c_i, int c_j) { if (visited[i][j]) { return true; } visited[i][j] = true; char col = my_array[i][j]; bool res = false; if (i > 0 && col == my_array[i - ...
#include <bits/stdc++.h> using namespace std; const int MAX = 3e5; int a[MAX] = {}; int main() { int t; cin >> t; while (t--) { char c; long long s; cin >> c >> s; long long a1 = 0; for (int i = 0; i < 18; i++) { a1 = a1 * 2 + s % 2; s /= 10; } ...
`timescale 1ns/1ns module spi_master #(parameter SCLK_DIV = 8'd8, parameter W = 8) (input c, output busy, output done, input [W-1:0] txd, input txdv, output [W-1:0] rxd, output rxdv, output sclk, output mosi, input miso, output cs); assign rxd = 8'h0; assign rxdv = 1'b0; wire [W-1:0] txd_d1; d1 #(8) txd_d1_r(.c...
module clock_counter( input clk_i, //often, "tags" are added to variables to denote what they do for the user input reset_n, //here, 'i' is used for input and 'o' for the output, while 'n' specifies an active low signal ("not") output reg clk_o ); reg [14:0] count; //register stores the counter value s...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
#include <bits/stdc++.h> using namespace std; int f(string s1, string s2) { int k = 0; while (s2 != s1) { s2 += s2[0]; s2 = s2.substr(1); k++; if (k > s2.length()) return 1000000; } return k; } int main() { int n; cin >> n; vector<string> V(n); for (int i ...
#include <bits/stdc++.h> using namespace std; int cnt[100500]; int bestAns, start, len; int longest[100500]; inline void updAns(int L, int R) { int val = cnt[R + 1] - cnt[L]; if (val > bestAns) { bestAns = val; start = L; len = R - L + 1; } } int main() { stack<pair<char,...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09/28/2016 11:50:35 AM // Design Name: // Module Name: box // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: // Revi...
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int N = 100010; int a[N]; bool cont[110][N]; long long f[N][110], sumf[N]; int main() { ios::sync_with_stdio(false); int n, k, len; cin >> n >> k >> len; for (int i = 1; i <= n; i++) cin >> a[i]; for (int j ...
#include <bits/stdc++.h> using namespace std; void task(); int main() { task(); return 0; } const int N = 2e5 + 10; const long long int MOD = (long long int)1e9 + 7; const int INF = 0x3f3f3f3f; const long long int LINF = (long long int)4e18 + 100; const int BUF_SIZE = (int)1e6 + 10; const do...
#include <bits/stdc++.h> using namespace std; inline int add(int _a, int _b) { if (_a < 0) { _a += 1000000007; } if (_b < 0) { _b += 1000000007; } if (_a + _b >= 1000000007) { return _a + _b - 1000000007; } return _a + _b; } inline int mul(int _a, int _b) { if (...
`define WIDTH_P 3 /**************************** TEST RATIONALE ******************************* 1. STATE SPACE WIDTH_P is the width of the number of wait cycles needed. So each test monitors the output for 2**WIDTH_P cycles. 2. PARAMETERIZATION The parameter WIDTH_P has little influence on the way DUT synt...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; queue<int> q; int cntD = 0, cntR = 0; for (int i = 0; i < n; i++) { if (s[i] == R ) cntR++; else cntD++; q.push(i); } int removeD = 0, removeR = 0; while ...
//Legal Notice: (C)2015 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; int K, N, M, Q; map<string, int> Basic, F[111]; string st, Comp_St[60]; vector<pair<string, int> > Comp[60]; int main() { cin >> K >> N >> M >> Q; for (int i = 1; i <= N; i++) { cin >> st; Basic[st] = i; } for (int i = 0, k; i < M; i+...
#include <bits/stdc++.h> using namespace std; const int N = 100005; long long b, q, l, m, a[N]; map<long long, int> vis; int main() { scanf( %lld%lld%lld%lld , &b, &q, &l, &m); while (m--) { long long x; scanf( %lld , &x); vis[x] = 1; } if (max(-b, b) > l) { printf( 0 n...
// -- (c) Copyright 2010 - 2011 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...
//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...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
/** * 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; int main() { int n; cin >> n; int m = 1; while (m * (m - 1) <= 2 * n) m++; m = m - 1; cout << m << n ; int arr[m + 4][m + 3]; long long k = 1; for (int i = 0; i < m; i++) { long long count = 0; for (int j = i; j < m - 1;...
#include <bits/stdc++.h> int inp() { char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); int sum = 0; while (c >= 0 && c <= 9 ) { sum = sum * 10 + c - 0 ; c = getchar(); } return sum; } char s[1000010], l[1000010], r[1000010]; long long f[1000010], sum[1000010];...
/* * 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...
module top( input clk, input rst, input [7:0] a, input [7:0] b, output [15:0] y); wire co; wire [31:0] out; SB_MAC16 i_sbmac16 ( .A(a), .B(b), .C(8'd0), .D(8'd0), .O(out), .CLK(clk), .IRSTTOP(rst), .IRSTBOT(rst), .ORSTTOP(rst), ...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // 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 2 of the License...
//----------------------------------------------------------------- // FPGA Audio Project SoC IP // V0.1 // Ultra-Embedded.com // Copyright 2011 - 2012 // // Email: // // License: LGPL // // If you wo...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:36777216 ) const int Nmax = 100100; const int Drection[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; int h, q; long long minV[55], maxV[55]; long long leftDown(long long L, int hg) { if (hg == h) return L; return leftDown(...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; long long sum = 0; for (int i = 0; i < n; i++) cin >> arr[i]; vector<int> odd, even; for (int i = 0; i < n; i++) { if (arr[i] & 1) odd.push_back(arr[i]); else even.push_bac...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == b) cout << YES ; else if (b - a > 0 && c > 0) { if ((b - a) % c == 0) cout << YES ; else cout << NO ; } else if (b - a > 0 && c < 0) { cout << NO ; ...
/* * 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 1 ns / 1 ps `include "hapara_bram_dma_switch_v1_0_tb_include.vh" // lite_response Type Defines `define RESPONSE_OKAY 2'b00 `define RESPONSE_EXOKAY 2'b01 `define RESP_BUS_WIDTH 2 `define BURST_TYPE_INCR 2'b01 `define BURST_TYPE_WRAP 2'b10 // AMBA AXI4 Lite Range Constants `define S00_AXI_MAX_BURST_LENGT...
/** * 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...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: five_new2.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ==========================...
#include <bits/stdc++.h> using namespace std; namespace IO { const int maxn(1 << 21 | 1); char *iS, *iT, ibuf[maxn], obuf[maxn], *oS = obuf, *oT = obuf + maxn - 1, c, st[20]; int f, tp, len; inline char getc() { return iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:43:39 03/09/2016 // Design Name: // Module Name: Control // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel 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 docum...
#include <bits/stdc++.h> using namespace std; int n, m, a[100][100], f[2000000], p; char s[30][30]; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) scanf( %s , s[i]); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf( %d , &a[i][j]); memset(f, 0x3f, sizeof(f)); ...
#include <bits/stdc++.h> const int mod = 998244353, g = 3, _g = 332748118, maxn = 2e5 + 9; inline int Pow(int base, int b) { int ret(1); while (b) { if (b & 1) ret = 1ll * ret * base % mod; base = 1ll * base * base % mod; b >>= 1; } return ret; } int r[maxn], W[maxn]; inline ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Programmable Interrupt Controller //// //// //// //// This file is part of the OpenR...
// (C) 2001-2015 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 doc...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<int> v(n), rank(n + 1), v1(m); for (int i = 0; i < n; i++) { cin >> v[i]; rank[v[i]] = i + 1; } for (int i = 0; i < m; i++) cin >>...
#include <bits/stdc++.h> using namespace std; multiset<long long> dd; long long su; long long revsum[100001]; struct tab { long long l; long long d; } arr[100001]; long long findsumoftop(long long k) { long long ans = 0; multiset<long long>::iterator it = dd.begin(); while (k--) { ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2014 Xilinx, Inc. // // 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 // /...
// Copyright 2020-2022 F4PGA 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
`timescale 1ns / 1ps //************************************************************************* // > ÎļþÃû: single_cycle_cpu_display.v // > ÃèÊö £ºµ¥ÖÜÆÚCPUÏÔʾģ¿é£¬µ÷ÓÃFPGA°åÉϵÄIO½Ó¿ÚºÍ´¥ÃþÆÁ // > ×÷Õß : LOONGSON // > ÈÕÆÚ : 2016-04-14 //******************************************************************...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:29:48 01/26/2016 // Design Name: rippleCarryAdder // Module Name: F:/VLSI Lab/Adder/rippleCarryAdderTest.v // Project Name: Adder // Target Device: // Tool vers...
#include <bits/stdc++.h> using namespace std; const int NMax = 100005; vector<int> G[NMax]; long double Array[NMax]; int DP[NMax], N; void Read() { cin >> N; for (int i = 1; i < N; i++) { int x; cin >> x; G[x].push_back(i + 1); } } void buildDP(int node) { DP[node] = 1;...
#include <bits/stdc++.h> using namespace std; long long ar[1005][1005], br[1005][1005], fr[555]; string s[555]; string s1, s2; int main() { long long i, j, k, m, n, r, c; while (cin >> r >> c) { getchar(); s[0] = ; for (i = 1; i <= r; i++) { getline(cin, s[i]); } ...
`include "uart.vh" module top( input ice_clk_i, input rstn_i, input rs232_rx_i, output [7:0] led_o, output rs232_tx_o ); reg tx_i_v = 0, fifo_re = 0, fifo_re_d = 0, fifo_we = 0; reg [`UART_DATA_LENGTH - 1 : 0] fifo_d = 0, tx_i = 0; wire clk_uart_rx, clk_uart_tx;...
`include "defines.v" module if_id( input wire clk, input wire rst, //input //Instruction input wire[31:0] insAddr_i, input wire[31:0] ins_i, //000000 00001 00010 00011 000001 00001 //Control input wire bubble_i, input wire pauseControl_i, input wire flush_i, //Exc...
// ethernet_port_interface_0.v // Generated using ACDS version 12.0 178 at 2012.08.08.17:01:19 `timescale 1 ps / 1 ps module ethernet_port_interface_0 ( input wire clk, // clock.clk input wire reset, // reset.reset input...
/* * 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) * ...
// megafunction wizard: %LPM_MULT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsquare // ============================================================ // File Name: MULT_FIRSQ.v // Megafunction Name(s): // altsquare // // Simulation Library Files(s): // altera_mf // ==================================...
/** *@file clk_synchronizer.v *@brief Synchronize a generated clock edge to pps *@author LUAN Yuezhen *@date Last edited 2016.11.15 *@tab Tab size = 4 spaces */ module clk_synchronizer#( parameter SYSCLK_FREQ_HZ = 64'd100_000_000, parameter PPS_HIGH_LEVEL_US = 64'd10_000, parameter GENCLK_FREQ_HZ = 1,...
/**************************************************************************** * Copyright (c) 2009 by Focus Robotics. All rights reserved. * * This program is an unpublished work fully protected by the United States * copyright laws and is considered a trade secret belonging to the copyright * holder. No part of ...