text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; vector<vector<long long>> mul(vector<vector<long long>> A, vector<vector<long long>> B) { int n = A.size(); vector<vector<long long>> res(n, vector<long long>(n)); for (int i = 0; i < n; i++) {... |
#include <bits/stdc++.h> using namespace std; int cnt[1000000 + 1]; const int mod = 1e9 + 7; vector<int> v; void solve() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int mx = a[n - 1]; deque<int> dq; int i = n - 1; for (i = n - 1; i ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1010; const double oo = 1E7, eps = 1E-7; struct point { double x, y; } P[maxn]; int n; double ansl, ansr; point operator+(point a, point b) { return (point){a.x + b.x, a.y + b.y}; } point operator-(point a, point b) { return (point){a.... |
#include <bits/stdc++.h> using namespace std; long long K, B, N, T; int main() { cin >> K >> B >> N >> T; if (K == 1 && 1 + N * B >= T) { cout << (int)ceil((1 + N * B - T) / (1.0 * B)) << endl; return 0; } if (K == 1) { cout << 0 << endl; return 0; } long long C = 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 la... |
#include <bits/stdc++.h> using namespace std; int a[] = {1, 2, 4, 3}; int b[] = {1, 3, 4, 2}; int c[] = {1, 4, 1, 4}; int d[] = {1, 1, 1, 1}; int main() { string s; cin >> s; int n = s.length(); int rem = 0; for (int i = 0; i < n; i++) { rem = (rem * 10 + s[i] - 0 ) % 4; } ... |
#include <bits/stdc++.h> using namespace std; const int size = 1e5 + 10; int afx[size]; int dis[size]; int main() { int n, k; scanf( %d%d , &n, &k); int total = 0; int ans = 0; for (int i = 0; i < n; i++) { scanf( %d , afx + i); dis[i] = 10 - afx[i] % 10; total += dis[i];... |
`default_nettype none
`timescale 1ns/1ns
module tb_mist1032isa_normal_test;
localparam PL_CORE_CYCLE = 20;
localparam PL_BUS_CYCLE = 20;
localparam PL_DPS_CYCLE = 18;
localparam PL_RESET_TIME = 20;
/****************************************
System
****************************************/
reg iCORE_CLOCK;
re... |
`timescale 1ns / 1ps
module ADD #(parameter N = 8, M = N)( // N >= M
input [N-1:0] A,
input [M-1:0] B,
input CI,
output CO,
output [N-1:0] S
);
wire [N-1:0] BB;
generate
if (N > M) begin: FA_IF
assign BB = {{(N-M){1'b0}}, B};
end else begin: FA_IF_N
assign BB = B;
end
endgenera... |
//======================================================================
//
// trng_avalanche_entropy.v
// ------------------------
// Wrapper for the avalanche entropy core to adapt it to the trng.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, Secworks Sweden AB
// All rights reserved.
//
// Redistribu... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12/20/2016 09:26:23 PM
// Design Name:
// Module Name: dstMgmt
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
/**
* 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; #pragma GCC optimize( -O3 ) struct vertex { bool vis = false; vector<pair<long long int, long long int> > adj; long long int low = 1000000007; long long int dp = 0; long long int parent = -1; }; long long int tim = 0, n, m; vector<pair<long l... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int k; cin >> k; int x; cin >> x; int* a; a = new int[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; } int index; index = n; while (k > 0) { a[index] = x; index--; ... |
// Copyright C(O) 2004 Burnell G West
// The following text may be utilized and / or reproduced by anybody for
// any reason.
//
// verr.v
//
module verr (clk, vout);
input clk;
output vout;
reg vout;
real start_edge;
real end_edge;
wire trigger_en;
wire [9:0] v_valu... |
#include <bits/stdc++.h> using namespace std; const long long p = 1000000007; char s[100005]; long long w[100005]; long long te[100005] = {1}; void build() { for (int i = 1; i <= 100000; i++) { te[i] = (te[i - 1] * 10) % p; } } long long quick_mod(long long a, long long b) { long long ... |
#include <bits/stdc++.h> using namespace std; long long n, sum, ans, a[100005]; inline long long read() { long long q = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = 0; ch = getchar(); } while (isdigit(ch)) { q = (q << 3) + (q << 1) + (ch ^ 48); ... |
#include <bits/stdc++.h> using namespace std; int a, ta, b, tb, x, y, sum, A, AA, B, BB; char ch; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; cin >> a >> ta >> b >> tb >> x >> ch >> y; A = 60 * x + y; AA = A + ta; for (int i = 5 * 60; i <= 1439; i += b) { B = i... |
#include <bits/stdc++.h> using namespace std; long long a, b; int t; int main() { cin >> t; while (t--) { cin >> a >> b; cout << a + b << n ; } return 0; } |
/*cia b*/
module ciab
(
input clk, // clock
input clk7_en,
input aen, // adress enable
input rd, // read enable
input wr, // write enable
input reset, // reset
input [3:0] rs, // register select (address)
input [7:0] data_in, // bus da... |
#include <bits/stdc++.h> using namespace std; const int inf = int(1e9) + 7; int main() { ios::sync_with_stdio(false); ios_base::sync_with_stdio(false); long long n, m; cin >> n >> m; vector<long long> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } if (n >= 1001) { c... |
#include<bits/stdc++.h> #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL); #define int long long #define ull unsigned long long #define FOR(i,a,b) for(int i=a;i<b;i++) #define all(x) (x).begin(), (x).end() #define pb push_back #define mp make_pair #define in insert #define ff first #def... |
#include <bits/stdc++.h> using namespace std; long long int ESP = 1e18; long long int FCB = 1e9 + 7; long long int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; const long long int N = 5005; long long int l[N], r[N]; vector<pair<long long int, long long int>> vv; bool fly(long long int x, long long int... |
/* -> Written by <- ----------- |K_A_Z_A_M_A| |___________| | ___ | | (^_^) | | /( | ) | |____|_|____| H O A N G */ #include <bits/stdc++.h> #define Task running #define F first #define S second #define pb ... |
#include <bits/stdc++.h> int main() { using namespace std; ios_base::sync_with_stdio(false); cin.tie(nullptr); string b, b1, b2, e, e1, e2; cin >> b1 >> b2 >> e1 >> e2; swap(b2[0], b2[1]); swap(e2[0], e2[1]); b = b1 + b2; e = e1 + e2; b.erase(b.find( X ), 1); e.erase(e.find... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Oct 27 10:19:57 2017
// Host : Juice-Laptop running 64-bit major relea... |
/**
* 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 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:49:45 01/23/2017
// Design Name: mux2_1
// Module Name: /home/aaron/Git Repos/CSE311/lab1_reverse/mux2_1_tb.v
// Project Name: lab1_reverse
// Target Device:
//... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n = 0, temp1 = 0, temp2 = 0; cin >> n; std::vector<long long int> v1; std::vector<long long int> v2; long long int hash1[100001], hash2[100001]; for (long long int i = 0; i < 100001; ++i) { hash1[i] = 0; has... |
/**
* 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 (c) 2014-2018 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, distri... |
#include <bits/stdc++.h> using namespace std; const int N = 100008; int n, a[N]; vector<pair<int, int> > ans; int main(void) { int i, j, k; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , a + i); for (i = 1; i + 2 <= n; i++) if (a[i]) { k = 1; for (j = 2; i + j <= n... |
#include <bits/stdc++.h> int star[100005]; int scnt; int pack[100005]; int pcnt; int unit(int x) { if (x > 0) return x; return 0; } int check(int time) { int i; int sat = 0; for (i = 1; i <= pcnt; i++) { if (sat >= star[scnt]) return 1; int l = 1, r = scnt, mid, idx; ... |
//-----------------------------------------------------------------
// RISC-V Top
// V0.6
// Ultra-Embedded.com
// Copyright 2014-2019
//
//
//
// License: BSD
//--------------------------... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, mod = 998244353; int add(int a, int b) { a += b; if (a >= mod) { a -= mod; } return a; } int sub(int a, int b) { a -= b; if (a < 0) { a += mod; } return a; } int mul(long long a, int b) { retu... |
#include <bits/stdc++.h> using namespace std; const int N = 5000 + 5; const int inf = 0x3f3f3f3f; const int Max = 200000; template <class T> inline void getin(T& num) { char c; bool flag = 0; num = 0; while ((c = getchar()) < 0 || c > 9 ) if (c == - ) flag = 1; while (c >= 0 ... |
`timescale 1ns/1ns
module spi_slave_rxq
(input c,
input cs, input sclk, input mosi,
output [7:0] rxd, output rxdv, output rxe);
wire [7:0] spi_rxd;
wire spi_rxdv, spi_rxe;
spi_slave_rx spi_slave_rx_inst
(.clk(c), .cs(cs), .sclk(sclk), .mosi(mosi),
.rxd(spi_rxd), .rxdv(spi_rxdv), .rxe(spi_rxe));
wire dfifo_rdreq,... |
/**
* 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; long long a[200005]; long long b[200005]; int i; for (i = 0; i < n; i++) { cin >> a[i]; a[i] = a[i] * (i + 1) * (n - i); } for (i = 0; i < n; i++) { cin >> b[i]; } sort(a, a + n); ... |
///////////////////////////////////////////////////////////////////////////////
//
// 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 Found... |
#include <bits/stdc++.h> using namespace std; int n, l, r, ql, qr; int w[100010]; int main() { cin >> n >> l >> r >> ql >> qr; for (int i = 1; i <= n; ++i) cin >> w[i]; int f[100010]; f[0] = 0; for (int i = 1; i <= n; ++i) f[i] = f[i - 1] + w[i]; int ans = INT_MAX; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long t = 1, n, k, fact, a, b; cin >> t; while (t--) { cin >> a >> b; if (a == 1) cout << 0 n ; else if (a == 2) cout << b <<... |
/*
* 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... |
/**
* 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)2010 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... |
`timescale 1ns / 1ps
`define SIMULATION
module peripheral_mult_TB;
reg clk;
reg rst;
reg reset;
reg start;
reg [15:0]d_in;
reg cs;
reg [1:0]addr;
reg rd;
reg wr;
wire [15:0]d_out;
peripheral uut (.clk(clk) , .rst(rst) , .d_in(d_in) , .cs(cs) , .addr(addr) , .rd(rd) , .wr(wr), ... |
#include <bits/stdc++.h> using std::map; using std::max; using std::min; using std::set; using std::sort; using std::swap; using std::vector; inline int readInt() { int ans = 0; char c; do c = getchar(); while (!isdigit(c)); while (isdigit(c)) { ans = ans * 10 + c - 0 ; ... |
#include <bits/stdc++.h> using namespace std; int n; string s; long long rights[1000010], lefts[1000010], mins[1000010]; long long suml[1000010], sumr[1000010]; int min(int a, int b) { return a < b ? a : b; } int main() { scanf( %d , &n); cin >> s; lefts[0] = 0; rights[n - 1] = 0; for ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sctag_vuad_io.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 redistribute it and... |
/*
* Copyright (C) 2007 Onno Kortmann <>
*
* 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, or
* (at your option) any later version.
*
* This program ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); vector<long long> tmp; int n, k; cin >> n >> k; long long mas[n], ans = 0; for (int i = 0; i < (int)(n); ++i) cin >> mas[i]; vector<pair<long long, long long> > ext; string s; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, x; cin >> n >> x; int arr[n + 5], brr[n + 5]; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 0; i < n; i++) { cin >> brr[i]; } sor... |
//-----------------------------------------------------------------------------
// File : spi_slave.v
// Creation date : 10.04.2017
// Creation time : 16:16:13
// Description : A minimalistic example for SPI slave IP-XACT document.
// Created by : TermosPullo
// Tool : Kactus2 3.4.20 32-bit
// Plugin : Ve... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; long long rev2 = (mod + 1) / 2; long long mas[300300]; long long pow2[300300]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %lld , &mas[i]); sort(mas, mas + n); pow2[0] = 1; for (int i =... |
`timescale 1 ns / 1 ps
//////////////////////////////////////////////////////////////////////////////////
// Company: AGH UST
// Engineer: Wojciech Gredel, Hubert Górowski
//
// Create Date:
// Design Name:
// Module Name: Clouds
// Project Name: DOS_Mario
// Target Devices: Basys3
/... |
/*
:Project
FPGA-Imaging-Library
:Design
FrameController2
:Function
Controlling a frame(block ram etc.), writing or reading with counts.
For controlling a BlockRAM from xilinx.
Give the first output after mul_delay + 2 + ram_read_latency cycles while the input enable.
:Module
Main module
:Version
1.0
:Modified
201... |
/**
* 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... |
//======================================================================
//
// online_tester.v
// ---------------
// Top level module in online random number generator tester.
// The module is basically a framework for instatiating and using
// specific test modules.
//
// The tests implemented are basically AIS31 with... |
#include <bits/stdc++.h> template <class T> using pt = std::pair<T, T>; using namespace std; struct poledia { int lx, ly, rx, ry; int cnt = 0; poledia() : lx(- -1e9), ly(- -1e9), ry(-1e9), rx(-1e9){}; poledia(bool is_dw) : lx(- -1e9), ly(-1e9), ry(- -1e9), rx(-1e9){}; }; struct poleos { ... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { vector<string> a; int n; cin >> n; a.resize(n); for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = n - 2; i >= 0; --i) { const char *x = a[i].c_str(), *y = a[i + 1].c_str(); int j = 1; while... |
//
// Copyright 2011 Ettus Research LLC
//
// 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 License, or
// (at your option) any later version.
//
// This program is dis... |
/////////////////////////////////////////////////////////////////////
//// ////
//// JPEG Quantization & Rounding Core ////
//// ////
//// Author: Richard Herveille ... |
#include <bits/stdc++.h> using namespace std; int n, m, nrE; struct Dish { int p, s, b; } d[100002]; struct Person { int inc, pref; } v[100002]; struct Event { int x, y, z, t; bool operator<(const Event &ot) const { if (x == ot.x) return z > ot.z; return x < ot.x; } } E[1... |
#include <bits/stdc++.h> using namespace std; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <class T> o... |
#include <bits/stdc++.h> using namespace std; char gc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline int read() { int x = 0, f = 1; char ch = getchar(); whi... |
/**
* 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 <iostream> using namespace std; int main() { long long t; cin >> t; while(t--) { long long n, s = 0, mx = 0; cin >> n; long long a[n + 1]; for(long long i = 1; i <= n; ++i){ cin >> a[i]; s += a[i]; m... |
/*
* 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; const int N = 23, M = 2e4 + 1e3 + 7, P = 998244353; int n; int cnt[N][26], pw[M]; char s[M]; int f[1 << N]; int mn[26]; int main() { pw[0] = 1; for (int i = 1; i < M; i++) pw[i] = pw[i - 1] * 2 % P; scanf( %d , &n); for (int i = 0; i < n; i++... |
#include <bits/stdc++.h> using namespace std; double cal(int n, int *a, double x) { double ret = 0, t1 = 0, t2 = 0; for (int i = 0; i < n; i++) { t1 += a[i] - x; t2 += a[i] - x; t1 = max(0., t1); t2 = min(0., t2); ret = max(ret, t1); ret = max(ret, -t2); } return ... |
/**
* 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... |
`default_nettype none
`timescale 1ns / 1ps
module oled_spi(
input wire clock,
input wire reset,
input wire shutdown,
output wire cs,
output reg sdin,
output wire sclk,
output reg dc,
output reg res,
output reg vbatc,
output reg vddc
);
parameter WAIT = 1;
parameter SEND = 2; // send 1 byte... |
module snoop_adapter (
clk,
reset,
kernel_clk,
kernel_reset,
address,
read,
readdata,
readdatavalid,
write,
writedata,
burstcount,
byteenable,
waitrequest,
burstbegin,
snoop_data,
snoop_valid,
snoop_ready,
export_address,
export_read,
ex... |
`define ADDER_WIDTH 008
`define DUMMY_WIDTH 128
`define 3_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_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... |
//////////////////////////////////////////////////////////////////////////////////
//
// Author : Praveen Kumar Pendyala
// Create Date : 30/10/13
// Modify Date : 11/11/13
// Module Name : simpleTestModuleOne
// Project Name : DDR2_Interface_Xilinx_XUPV5
// Target Devices : Xilinx Vertix... |
/*
* sobel_cache.v
*
* Created on: 09/10/2012
* Author: Lord_Rafa
*/
`timescale 1 ps / 1 ps
module Sobel_cache (
input clk,
input rst,
input start,
input [ADD_WIDTH-1:0] base_add,
input [13:0] rdaddress,
output wire [12:0] valid_lin... |
/*
* 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; bool EulerianPathExists(const map<string, pair<int, int>>& in_out_degrees) { int different_in_out_count = 0; for (auto& key_val : in_out_degrees) { if (key_val.second.first != key_val.second.second) { ++different_in_out_count; if (different... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); long long int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a] = i + 1; } for (int i = 1; i <= n; i++) { cout << mp[i] <<... |
`timescale 1ns / 1ps
module MAC #(
parameter N = 5,
parameter PIPE = 3,
parameter WIDTH = 16,
parameter M_WIDTH = 2*WIDTH+N-1
)(
input clk,
input sof,
input [WIDTH-1:0] A,
input [WIDTH-1:0] B,
output reg [M_WIDTH-1:0] C,
output reg valid
);
reg state;
reg [7:0] n,p;
w... |
#include <bits/stdc++.h> using namespace std; int main() { float a, b, c, d; float mpts; float vpts; cin >> a >> b >> c >> d; mpts = max((3 * a) / 10, a - ((a / 250) * c)); vpts = max((3 * b) / 10, b - ((b / 250) * d)); if (mpts == vpts) { cout << Tie n ; return 0; } ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
/***************************************************************************************************
** fpga_nes/hw/src/wram.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following... |
#include <bits/stdc++.h> using namespace std; int main() { int a[200], b[200]; int countA = 0; int countB = 0; int countC = 0; int n = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } for (int i = 0; i < n;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> m >> n; vector<string> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } string s = ; for (int i = 0; i < n; i++) s += ; vector<string> ans(m, s); for (int i = 0; i < n; i++) for (int j ... |
//Legal Notice: (C)2021 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... |
/**
* 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; const int ALPHABETS = 30; const int maxN = 410; bitset<maxN> orig[ALPHABETS][maxN], ans[maxN]; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, M; cin >> N >> M; string s; for (int i = 0; i < N; i++) { cin >> s; for ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const double EPS = 1e-9; const int INF = 1 << 29; int const NN = 5e3 + 3; int const MX = 1e9 + 9; int a[505][505]; int mx[505][505]; int main() { int n, m, K, q; cin >> n >> m >> K >> q; for (int i = 1; i <= n; ++i) { ... |
/*
* Copyright (c) 2013 Travis Geiselbrecht
*
* 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,... |
#include <bits/stdc++.h> using namespace std; int i, j, n; int a[1005]; string s; int main() { ios::sync_with_stdio(0); cin.tie(NULL); cin >> n; n--; cin >> s; for (i = 0; i <= n; i++) a[i] = 1; for (i = 0; i < n; i++) { if (s[i] == = ) a[i + 1] = a[i]; if (s[i] == R ... |
#include <bits/stdc++.h> using namespace std; int main() { int N; scanf( %d , &N); if (N == 1) { puts( 1 ); return 0; } int s = 0; for (int i = 0; i < N; ++i) { int t; scanf( %d , &t); s += t; } printf( %d n , s % N == 0 ? N : N - 1); } |
#include <bits/stdc++.h> using namespace std; using LL = long long; const int MAXN = 11; const int MAXM = 1e4 + 5; int n, m, ex[MAXN]; int cnt[30]; char w[MAXN][MAXM]; void solve() { scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) scanf( %d , &ex[i]); for (int i = 0; i < n; i++) scanf( %... |
// State register (R0)
module r0 (
input clk_sys,
input strob1b,
// parallel input
input [0:15] w,
// flag inputs
input zs, s_1, s0, carry, vl, vg, exy, exx,
// flag set commands
input ust_z, ust_v, ust_mc, ust_y, ust_x, cleg,
// W->R0
input w_zmvc, w_legy, lrp,
// async resets
input _0_v,
input zer,
// ... |
#include <bits/stdc++.h> using namespace std; const long long int inf = 1000000000; const long long int mod = 1000000000 + 7; inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } inline int dcmp(long double x) { return x < -1e-12 ? -1 : (x > 1e-12); } template <class T> ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2021 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n",... |
//
module ram_controller_ex_lfsr8 (
clk, reset_n, enable, pause, load, data, ldata);
parameter seed = 32;
input clk;
input reset_n;
input enable;
input pause;
input load;
output[8 - 1:0] data;
wire[8 - 1:0] data;
input[8 - 1:0] ldata;
reg[8 - 1:0] lfsr_data;
assign data = lfsr_data ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.