text stringlengths 59 71.4k |
|---|
/************************************************
* *
* Derek Prince *
* ECEN 2350: Digital Logic *
* 2n-bit Comparator on the terasiC DE0 board *
* Altera Cyclone 3 EP3C16F484 *
* ... |
// Copyright (c) 2000-2009 Bluespec, Inc.
// 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, pub... |
#include <bits/stdc++.h> using namespace std; void solve(long long int test) { long long int n; cin >> n; cout << n << endl; for (long long int i = 1; i <= n; i++) cout << i << ; cout << endl; } int main() { long long int t = 1, test = 1; cin >> t; while (t--) { solve(te... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { int a, b, n, s; cin >> a >> b >> n >> s; if (s - n * min(a, s / n) <= b) cout << YES n ; else cout << NO n ; } return 0; } |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
//
// RCN bus RAM
//
module rcn_ram
(
input clk,
input rst,
input [68:0] rcn_in,
output [68:0] rcn_out
);
parameter ADDR_BASE = 0;
wire cs;
wire wr;
wire [3:0] mask;
wire [23:0] addr... |
#include <bits/stdc++.h> using namespace std; int n, m, p, last[10]; struct node { int x, y; }; int s[10]; char a[1005][1005]; int vis[1005][1005], ans[10], can[10]; queue<node> que[10]; int d[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; void bfs() { for (int i = 1; i <= p; i++) { while... |
/* https://codeforces.com/blog/entry/87523 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100000 int *ej[N], eo[N]; void append(int i, int j) { int o = eo[i]++; if (o >= 2 && (o & o - 1) == 0) ej[i] = (int *) realloc(ej[i], o * 2 * sizeof *ej[i]); ej[i][o] =... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int a[N], cnt[N]; int f[N], bj[N]; vector<int> d[N]; int n, mx; long long ans; void init(int n) { for (int i = 1; i <= n; i++) f[i] = 1; for (int i = 2; i <= n; i++) { if (bj[i]) continue; f[i] = -1; for (int j... |
/*
* 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... |
//*****************************************************************************
// (c) Copyright 2013 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
// ... |
`timescale 1ns / 1ps
/*
-- Module Name: network core
-- Description: Top level de router NoC.
-- Dependencies: -- system.vh
-- router.v *
-- data_path.v
-- Original Author: Héctor Cabrera
-- Current Author:
-- Notas:
-- History:
-- 05 de Junio 2015: Creacion
-- 11 de Junio 2015: Actualizacion... |
//name : file_writer
//tag : c components
//input : input_a:16
//source_file : file_writer.c
///===========
///
///*Created by C2CHIP*
`timescale 1ns/1ps
module file_writer(input_a,input_a_stb,clk,rst,input_a_ack);
integer file_count;
integer output_file_0;
input clk;
input rst;
input [31:0] in... |
// synopsys translate_off
`include "rtl/verilog/or1200/timescale.v"
// synopsys translate_on
`include "rtl/verilog/or1200/or1200_defines.v"
/*
***********************************************************
davide 08/03/2017 - 13:50 :
looks like working as expected. just changed enable signal to softreset.
now the m... |
//===============================================//
module radio_rx( input CLK_1M,
input RESET,
input RADIO_IN,
output [31:0] DATA_OUT );
wire sync_out, clean_out, edge_p, edge_n, online;
wire [11:0] pulse_width;
sync smodule(CLK_... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; scanf( %I64d %I64d , &n, &m); long long a = min(n, m); long long b = max(n, m); long long ans; if (a == 1) { ans = b / 6 * 6; if (b % 6 == 4) ans += 2; else if (b % 6 == 5) ans += 4; ... |
#include <bits/stdc++.h> using namespace std; int q[100010], t, n; bool cmp(int a, int b) { return a < b; } int main() { scanf( %d , &t); for (int i = 1; i <= t; i++) { scanf( %d , &n); for (int j = 1; j <= n; j++) { scanf( %d , &q[j]); } int flag = 1; sort(q + 1, q... |
#include <bits/stdc++.h> using namespace std; const int N = (1 << 18); int xtoy[N], ytox[N]; set<int> sx, sy; int tr[2][N * 2]; void change(int c, int x, int v) { x = x + N; tr[c][x] = v; while (x > 1) { x /= 2; tr[c][x] = max(tr[c][x * 2], tr[c][x * 2 + 1]); } } int get_max(... |
//
// ICBLBC with usb 2.0 to host,
// for DE2-115 board and SMSC USB3300 PHY
// top-level
//
// Copyright (c) 2013 Dominic Spill
//
// This file is part of Unambiguous Encapsulation.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public Lice... |
/*
* 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 = 1e6 + 100; const double PI = 3.14159; vector<int> v; long long n, m, k, t, ans, sum, r, l, b, c, d, a; bool f; string s; set<int> st; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cin >> n >> m; for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; const int maxn = (int)1e5 + 100; double alpha[maxn], beta[maxn]; double a[maxn], b[maxn]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %lf , &beta[i]); for (int i = 0; i < n; i++) scanf( %lf , &alpha[i]); double Sa = ... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2004 Xilinx, Inc.
// All Rights Reserved
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version: 1.01
// ... |
module clock_divider(
input wire clk,
input wire reset,
input wire enabled,
output reg refresh_clk,
output reg sys_clk
);
reg [8:0] counter1;
reg [8:0] counter2;
reg [8:0] clk_divid;
always@(posedge clk or negedge reset)
begin
if( ~reset )
begin
refresh_clk <= 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; const int inf = (1 << 30); int dp[110][700][40], g[35][35]; string s; int solve(int p, int k, int q) { if (p < 0 && k >= 0) return 0; if (p < 0 || k < 0) return -inf; if (dp[p][k][q] != -1) return dp[p][k][q]; char ch = q + a ; int ans = -inf;... |
/**
* 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> #pragma GCC optimize(3) using namespace std; int n, x, y, final, a[100500], dep[100500], maxn, root, f[100500]; std::vector<int> G[100500]; priority_queue<int> Que; void DFS1(int now, int fa) { for (int i = 0; i < (int)G[now].size(); i++) { if (G[now][i] == fa) continue; ... |
(
input rst_b,
input p1_clk,
input p1_select,
input p1_rdnw,
input p2_clk,
input p2_select,
input p2_rdnw,
output p2_data_available,
output p1_full
);
// Initial state: 0 = empty; 1 = full
parameter init = 0;
wire req;
reg req_s1;
reg req_s2;
wire ack;
reg ack_... |
#include <bits/stdc++.h> using namespace std; const int N = 100005, mod = 1000000007; int n, m, T, q, f[6]; int main() { cin >> n; for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); for (int j = 1; j <= 4; j++) { if ((j & 1) == (x & 1)) f[j]++; } for (int j = 2;... |
// system1_nios2_gen2_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module system1_nios2_gen2_0 (
input wire clk, // ... |
module autoconstant_gooch
(/*AUTOARG*/
// Outputs
out1, out2, out3,
// Inputs
in1, in2, in3
);
input [3:0] in1;
input [3:0] in2;
input [3:0] in3;
output [3:0] out1;
reg [3:0] out1;
output [3:0] out2;
reg [3:0] out2;
output [3:0] out3;
reg [3:0] out3;
... |
/*
* University of Illinois/NCSA
* Open Source License
*
* Copyright (c) 2007-2014,The Board of Trustees of the University of
* Illinois. All rights reserved.
*
* Copyright (c) 2014 Matthew Hicks
*
* Developed by:
*
* Matthew Hicks in the Department of Computer Science
* The University of Illinois at... |
#include <bits/stdc++.h> using namespace std; int main() { int t, cont = 0, z = 0, x, n; int a[] = {1, 3, 6}; cin >> t; for (int i = 0; i < t; i++) { cin >> n; x = n; while (x > 0) { x = x / 10; z++; } if (z == 4) { for (int k = 1; k <= 9; k++) {... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const long long MOD = 1000000007; const int INF = 1e9; const long long LINF = 1LL * INF * INF; const int MAXN = 100007; const double EPS = 1e-7; con... |
// -- (c) Copyright 2008 - 2012 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... |
#include <bits/stdc++.h> using namespace std; const long double pi = 3.1415926535897932384626433832795l; template <typename T> inline auto sqr(T x) -> decltype(x * x) { return x * x; } template <typename T1, typename T2> inline bool umx(T1& a, T2 b) { if (a < b) { a = b; return 1; ... |
`ifdef cyclonev
`define LCELL cyclonev_lcell_comb
`define MAC cyclonev_mac
`define MLAB cyclonev_mlab_cell
`define RAM_BLOCK cyclonev_ram_block
`define IBUF cyclonev_io_ibuf
`define OBUF cyclonev_io_obuf
`define CLKENA cyclonev_clkena
`endif
`ifdef arriav
`define LCELL arriav_lcell_comb
`define MAC arriav_mac
`define M... |
module jboothMultiplierTb;
wire [7:0] Y;
reg [3:0] A, B;
jboothMultiplier jbm(Y, A, B);
initial
begin
$display("RSLT\tA x B = Y");
A = 2; B = 2; #10;
if ( Y == 4 )
$display("PASS\t%p x %p = %p",A,B,Y);
else
$display("FAIL\t%p x %p = %p",A,B,Y);
A = 3; B = 3; #10;
if (... |
/*
* ram_r.v
*
* Created on: 09/10/2012
* Author: Lord_Rafa
*/
`timescale 1 ps / 1 ps
module ram_r(
input clk,
input rst,
output wire[ADD_WIDTH-1:0] ram_r_address,
input ram_r_waitrequest,
input ram_r_readdatavalid,
output wire[BYTE_ENABLE_WIDTH-1:0] ram_r_byteenable,... |
#include <bits/stdc++.h> using namespace std; int dp[10][10][10][10], pres_path; void dfs(int x, int y, int u, int v, int p); void dfs_next(int x, int y, int u, int v, int p) { int &t = dp[x][y][u][v]; if (t == 0 or t > pres_path + 1) { t = ++pres_path; if (p < 10) dfs(x, y, u, v, p + 1); ... |
#include <bits/stdc++.h> using namespace std; const int OO = 1e9, N = 1e5; int main() { long long n, c = 0, o = 0; cin >> n; string s; cin >> s; queue<int> q; for (int i = 0; i < n; i++) { o += (s[i] == ( ); c += (s[i] == ) ); } int sma7 = 0; for (int i = 0; i < n... |
/*
Copyright (c) 2016 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; int n, k, trie[100100][27], sz = 1, ok[2][100100]; char s[100100]; void add() { int v = 0; for (int i = 0; s[i] != 0 ; i++) { if (trie[v][s[i] - a ] == 0) trie[v][s[i] - a ] = sz++; v = trie[v][s[i] - a ]; } } void calc(int v, bool b... |
#include <bits/stdc++.h> using namespace std; int n, m, k; int a[15][110], b[15][110], c[15][110]; char buf[15]; int calc(int p, int q) { static pair<int, int> d[110]; int cnt = k, res = 0; for (int i = 1; i <= m; i++) d[i].first = b[q][i] - a[p][i], d[i].second = c[p][i]; sort(d + 1, d ... |
/*
* 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... |
// (c) Copyright 2012-2013 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 g... |
/**
* 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%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: six_new2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============================... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int ans = ((n - 1) * n * (n + 1)) / 3 - 2; cout << ans; return 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 law... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; set<int, greater<int> > s; int main() { int q; scanf( %d , &q); while (q--) { s.clear(); int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); s.insert(x);... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 105; string name[MAXN], surname[MAXN]; bool u[MAXN]; int n; int x1[30], x2[30]; int Getn() { int res = 0; for (int i = 0; i < 26; i++) res += min(x1[i], x2[i]); return res; } int main() { cin >> n; for (int i = 1; i <= ... |
module rgmii
(
input wire reset,
input wire generated_clk,
// PHY Interface
output wire [3:0] phy_txd_rising,
output wire [3:0] phy_txd_falling,
output wire phy_tx_ctl_rising,
output wire phy_tx_ctl_falling,
output wire phy_gtx_clk,... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> vec; vec.push_back(0LL); for (int i = 0; i < n; i++) { long long k; cin >> k; vec.push_back(k); } int m; cin >> m; vector<long long> v; long long x = 0, y = 0; ... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, i; cin >> n; int ara[n]; for (int i = 0; i < n; ++i) { cin >> ara[i]; } for (i = 1; i < n; i++) { if (ara[i] != ara[i - 1]) { cout << 1 n ; return; } } cout << n << endl; } int ... |
/*
* 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; string a; int main() { cin >> a; if (a == string(a.size(), a )) { cout << string(a.size() - 1, a ) << z << endl; } else { for (int i = 0; i < a.size(); i++) { if (a[i] != a ) { int x = i; while (x < a.size() && ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string st; cin >> st; int k, fi, se, cnt = 0; cin >> k; for (int i = 0; i < k; i++) { char a, b; cin >> a >> b; fi = se = 0; for (int j = 0; j < st.length()... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
/**
* 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; template <class T1, class T2> int upmin(T1 &x, T2 v) { if (x <= v) { return 0; } x = v; return 1; } template <class T1, class T2> int upmax(T1 &x, T2 v) { if (x >= v) { return 0; } x = v; return 1; } const int INF ... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
//------------------------------------------------------------------------------
// SHARED CODE
//------------------------------------------------------------------------------
// No shared code for ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const int INF = 1e9; const long long LINF = 1LL * INF * INF; const int MAXN = 100007; const double EPS = 1e-7; int A[MAXN]; int main() { ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; if (n == 1 && m ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 &y) { ... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
// (C) 2001-2011 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... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of opm
//
// Generated
// by: wig
// on: Mon Jan 22 13:12:07 2007
// cmd: ../../mix_0.pl -report portlist bug_20061214a-pin-list.xls templ-HIER.xls
//
// !!! Do not edit this file! Autogenerated by MIX... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int maxn = 1e5 + 5; long long h[maxn], l[maxn], r[maxn]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %lld , &h[i]); l[1] = r[n] = 1; for (int i = 2; i <= n; ++i) l[i] = min(h[i], l[i -... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu May 25 15:29:57 2017
// Host : GILAMONSTER running 64-bit major release (... |
/**
* 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 n, s, e; int x[5555], a[5555], b[5555], c[5555], d[5555]; long long dist(int from, int to) { return 1LL * abs(x[from] - x[to]) + (from < to ? d[from] + a[to] : c[from] + b[to]); } int main() { ios::sync_with_stdio(0); cin >> n >> s >> ... |
#include <bits/stdc++.h> using namespace std; long long E[50]; int get_len(long long s) { int cnt(0); while (s) cnt++, s /= 10; return cnt; } int find(long long n, int l) { if (n == 0) return 0; int len = get_len(n); if (n < E[l]) { return min(find(n, l - 1), find(E[l] - n, l - 1... |
#include <bits/stdc++.h> using namespace std; long long fact(long long n) { if (n == 0 || n == 1) return 1; else return n * fact(n - 1); } long long gcd(long long a, long long b) { if (a < 0) a = -a; if (b < 0) b = -b; if (a == 1 || b == 1) return 1; else if (a == 0) ... |
#include <bits/stdc++.h> using namespace std; int main() { long long m, b; cin >> m >> b; long long Max = 0; for (long long i = b; i >= 0; i--) { long long p = (m * b - m * i + 1) * (i + 1) * (m * b - m * i + i) / 2; Max = max(p, Max); } printf( %I64d , Max); return 0; } |
module duration_lut (input [3:0] lookup, output [15:0] duration);
// NOTE: Slowest frequency from prescaler is 100Hz, which corresponds to 1 BPM
// 1 BPM is actually 1/60 Hz, so to accurately time a note requires 6,000 cycles of the prescaler
// NOTE: A BPM command will be accompanied by an UNDEF lookup, so it shou... |
#include <bits/stdc++.h> using namespace std; long long srw[1000], scol[1000]; long long rows[1000001], cols[1000001]; int main() { int x, n, m, k, p, y, i, j; scanf( %d%d%d%d , &n, &m, &k, &p); for (i = 0; i < n; i++) for (j = 0; j < m; j++) { scanf( %d , &x); srw[i] += x; ... |
#include <bits/stdc++.h> clock_t t = clock(); namespace my_std { using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T rnd(T l, T r) { return uniform_int_distribution<T>(l, r)(rng); } template <typename T> inline bool chkmax(T &x, ... |
//
// Test bench for memory.v
//
// Inspired by tutorial here: http://www.asic-world.com/verilog/art_testbench_writing.html
//
`include "timescale.vh"
module memory_tb;
// Define the inputs
reg resn;
reg clk;
wire [7:0] enables;
//------------------------------------------------... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: rx_64_1.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ===================================... |
`timescale 1ns / 1ps
module InstMemory
(
// Input
input Reset,
input Clk,
input [31:0] MemAddr,
// Output
output wire [31:0] MemDataOut
);
// Internal Variables
reg [31:0] Memory[0:63];
reg [5:0] Addr;
assign MemDataOut = Memory[Addr];
always @ ( ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long double pi = acos(-1); const int MOD = 1e9 + 7; const long long int LINF = 0x3f3f3f3f3f3f3f3f; int n, m, k, s; const int MAXN = 2005; int a[MAXN][MAXN]; int maxma[15], maxme[15], minma[15], minme[15]; int seq[MAXN * ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, a, b, s = 0; char s1[10001], s2[10001]; cin >> n; cin.ignore(10000, n ); cin.get(s1, 10001, n ); cin.ignore(10000, n ); cin.get(s2, 10001, n ); cin.ignore(10000, n ); for (i = 0; i < n; ++i) { if... |
#include <bits/stdc++.h> using namespace std; const int N = 300010; int total[N]; vector<pair<pair<int, int>, int> > e[N]; int dir[N], from[N], to[N]; int visit[N]; int n, m; int main() { scanf( %d%d , &n, &m); memset(total, 0, sizeof(total)); for (int i = 1; i <= m; i++) { int u, v, w... |
#include <bits/stdc++.h> using namespace std; const int OO = 2e9; const int MOD = 1e9 + 7; const double Pi = 3.141592653589793; const int N = 3e5 + 5; long long c[N], v[N], g[N], a[N], n, k, s, t, m = 0, mx = 0, mn = -1, res = OO; bool check(long long cap) { long long time = 0; for (int i = (int)1... |
#include <bits/stdc++.h> using namespace std; int n, k; const int maxn = 500; int v[maxn + 5]; long long vv[maxn + 5]; int ans[maxn + 5]; int r[maxn + 5]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &v[i]); scanf( %d , &k); for (int i = 0; i < k; i++) scanf( %I6... |
#include <bits/stdc++.h> using namespace std; int main() { int m, n; cin >> n >> m; int c[n]; for (int i = 0; i < n; i++) cin >> c[i]; int a[m]; for (int i = 0; i < m; i++) cin >> a[i]; int d = 0, j = 0; for (int i = 0; i < n; i++) { if (a[j] >= c[i]) { d++; j++... |
#include <bits/stdc++.h> using namespace std; struct event { int pos, type, p; event(int pos = 0, int type = -1, int p = 0) : pos(pos), type(type), p(p) {} bool operator<(const event &e) const { if (pos == e.pos) return type < e.type; return pos < e.pos; } }; const int maxE = 5e5 + 1... |
#include <bits/stdc++.h> using namespace std; const int Inf = 1000000000; const int Maxn = 30005; const int Maxk = 205; const int Maxd = 6; int n, k; int a[Maxn]; int dp[Maxn][Maxk][2][Maxd]; int main() { scanf( %d %d , &n, &k); for (int i = 0; i < n; i++) scanf( %d , &a[i]); fill((int*)dp... |
#include <bits/stdc++.h> using namespace std; int arr[98]; int main() { string s; vector<long long> v(4); for (int i = 0; i < 4; i++) cin >> v[i]; sort(v.begin(), v.end()); char c1, c2, c3; cin >> c1 >> c2 >> c3; if (c1 == * && c2 == * && c3 == * ) cout << v[0] * v[1] * v[2]... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; int n, m, b[N][N], a[N][N]; void solve() { if (n % 2) { printf( %d n , n); return; } bool ok = 1; while (n > 1 && ok && n % 2 == 0) { for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ... |
/**
* 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 mux_case (
clk_in,
clk_1s,
rst,
sel_i,
df,
df_0,
ed,
q_o
);
input clk_in,rst,clk_1s; //system clk and rst
input df,df_0,ed; //df,df_0 is switch for stop and rst. ed for auto rst at 24:00
output [1:0] sel_i;
output q_o;//led signal
reg q_o;
reg[1:0] sel=0;
always@(posedge clk... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pll = pair<ll, ll>; bool cmpx(const pll& a, const pll& b) { return a.first < b.first; } bool cmpy(const pll& a, const pll& b) { return a.second < b.second; } ll sq(const ll& first) { return first * first; } ll dis(const pll& a, cons... |
#include<bits/stdc++.h> #define int long long using namespace std; 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 ... |
#include <bits/stdc++.h> using namespace std; const int tt = 100005; struct edge { edge *nxt; int des; void maker(edge *&a, int b) { nxt = a, des = b; a = this; } } w[tt], *sta[tt], *tot; struct treap { treap *l, *r; int key, sz, ran; } * seg[tt * 4], buf[2000000], *pos; ... |
#include <bits/stdc++.h> using namespace std; int n, m; long long a[30], b[30], dp[30][30][30]; struct node { long long dis[30][30]; node operator*(const node &t) const { node rep; memset(rep.dis, 0x3f, sizeof rep.dis); for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) ... |
#include <bits/stdc++.h> using namespace std; int thien, n, tt, h; string s; int main() { cin >> tt; for (int ii = 1; ii <= tt; ii++) { cin >> n; thien = 0; h = 0; for (int i = 1; i <= n; i++) { cin >> s; if (s.length() % 2 != 0) thien++; for (int j = 0; j... |
/*
* 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 law... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.