text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { int n, i; cin >> n; string s; map<char, int> m; for (i = 0; i < n; i++) { cin >> s; m[s[0]]++; } int ans = 0, f1, f2; for (auto it = m.begin(); it != m.end(); it++) { f1 = it->second / 2; f2 = it->seco...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:19:07 04/23/2015 // Design Name: modBigNumbers // Module Name: U:/public/Final Project Elec 245/PrimeFactorization/test_mod_big_numbers.v // Project Name: PrimeFa...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Double-Port Synchronous RAM //// //// //// //// This file is part of memory li...
// // 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) // ...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // // Module: dma_engine_alignment.v // Project: CPCI (PCI Control FPGA) // Description: Re-alignment module to handle unaligned transfers // // Note: read and write are from the persp...
`timescale 1 ns / 1 ps `include "axi_traffic_controller_v1_0_tb_include.vh" module axi_traffic_controller_v1_0_tb; reg tb_ACLK; reg tb_ARESETn; reg M_AXI_INIT_AXI_TXN; wire M_AXI_TXN_DONE; wire M_AXI_ERROR; // Create an instance of the example tb `BD_WRAPPER dut (.ACLK(tb_ACLK), .ARESETN(tb_ARESETn), ...
#include <bits/stdc++.h> using namespace std; int n, m, st; int tmp, tmp2; vector<int> adj[200005]; int memo[200005][5]; bool vis[200005][5]; int stc, stn; pair<int, int> par[200005][5]; int dp(int node, int cur) { if (adj[node].size() == 0) { if (cur == 2) { stc = cur; stn =...
/* * This file was generated by the scsynth tool, and is availablefor use under * the MIT license. More information can be found at * https://github.com/arminalaghi/scsynth/ */ module ReSC_wrapper_varied_bin_lengths_test( //handles stochastic/binary conversion for ReSC input [5:0] x_bin, //binary value of input i...
#include <bits/stdc++.h> using namespace std; long long const N = 2e5 + 70; long long n, k, a[N], cnt[N], ans, fi = -1, la = -1; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; for (long long i = 0; i <= n; i++) { cin >> a[i]; cnt[i] = a[i]; ...
#include <bits/stdc++.h> using namespace std; long long int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p = 0, q = 0, r, s, t, u, v, w, x, y, z, temp = 0, ans = 0, t1, t2, sum = 0; vector<long long int> v1, v2, v3, v4, v5, v6; vector<string> vs1, vs2, vs3, vs4; double f1, f2 = 0, f3, f4; vector<doubl...
/** * 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) 2000-2012 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; vector<pair<long long int, long long int> > v1, v2; int main() { long long int p, q, l, r, w, x, y, z, i, j, flag, tot = 0, k; scanf( %lld , &p); scanf( %lld , &q); scanf( %lld , &l); scanf( %lld , &r); for (i = 0; i < p; i++) { scanf( %l...
#include <bits/stdc++.h> using namespace std; int p[100001], w[100001]; bool combine(int x, int y) { while (p[x] != x) x = p[x] = p[p[x]]; while (p[y] != y) y = p[y] = p[p[y]]; if (x == y) return false; if (w[x] < w[y]) w[p[x] = y] += w[x]; else w[p[y] = x] += w[y]; return true...
#include <bits/stdc++.h> const int N = 2001, INF = 1e9 + 7; long long g[N][N], f[N][N]; int main() { int n, k; std::cin >> n >> k; std::string s; std::cin >> s; f[0][0] = g[0][0] = 1; for (int i = 1; i <= n; ++i) for (int j = 0; j <= k; ++j) { g[i][j] = f[i - 1][j] * (s[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 la...
/* * Copyright (C) 2011 Kiel Friedt * * 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 p...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MXN = 3e5 + 5; const int MOD = 998244353; const int LOG = 19; int add(int x, int y) { return (x += y) < MOD ? x : x - MOD; } int sub(int x, int y) { return (x -= y) >= 00 ? x : x + MOD; } int mul(int x, int y) { return (ll)x *...
#include <bits/stdc++.h> using namespace std; long long solve() { long long n; cin >> n; string str1, str2; cin >> str1 >> str2; long long freq1[26] = {0}; long long freq2[26] = {0}; for (long long i = 0; i < n; i++) { freq1[str1[i] - a ]++; freq2[str2[i] - a ]++; } ...
#include <bits/stdc++.h> using namespace std; const int N = 100001; int main() { char c[3][3], cc[3][3]; char s[3][3]; int ind1, ind2; int ii = 0; for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) { cin >> c[i][j]; cc[i][j] = c[i][j]; } for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; int main() { char a[200]; char c; int i = 0; while ((c = getchar()) != n ) { a[i] = c; i++; } for (int k = 0; k < i - 2; k++) { if (a[k] == W && a[k + 1] == U && a[k + 2] == B ) { a[k] = ; a[k + 1] = ...
#include <bits/stdc++.h> int n, m, x, i, ans; int main() { scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d , &x); if (x == 2) ++m; } if (n == 1) ans = 1; if (n == 2 && m == 0) ans = 2; if (n == 2 && m == 1) ans = 2; if (n == 2 && m == 2) ans = 2; if (n == 3 && m == ...
#include <bits/stdc++.h> using namespace std; string s; struct substring { int f, b; bool operator>(const substring &o) const { int cmp = s.compare(f, b - f + 1, s, o.f, o.b - o.f + 1); return cmp != 0 ? cmp > 0 : f > o.f; } }; string kthSubstring(int k) { priority_queue<substring,...
/* * 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 (c) 2016, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:02:55 03/24/2015 // Design Name: // Module Name: arithm // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; const int maxn = 3000 + 10; int n, m, A[maxn], B[maxn]; long long f[maxn][maxn]; void init() { scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &A[i]); A[i] -= i; B[i] = A[i]; } } void 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 law...
#include <bits/stdc++.h> using namespace std; long n, m; char c; long hi[600000][3], hj[600000][3], ans; long temp; long l, u; int main() { ios_base::sync_with_stdio(0); cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { cin >> c; if (c == . ) con...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2009 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. module t (); sub a (.inst(1)); ...
#include <bits/stdc++.h> using namespace std; class p1328D { public: void solve() { int q; cin >> q; while (q--) { int n; cin >> n; vector<int> t(n); for (int i = 0; i < n; i++) cin >> t[i]; int sum = 1; for (int i = 1; i < 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:31:43 08/22/2017 // Design Name: // Module Name: dma // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Rev...
#include <bits/stdc++.h> using namespace std; int n; char buf[100], name[100], op[100], tmp[100]; struct widget { long long x, y; bool finish; int type, border, spacing; vector<int> w; widget(long long xx = 0, long long yy = 0, int t = 0) { x = xx; y = yy; type = t; w...
#include <bits/stdc++.h> using namespace std; long long input[(long long)1e5 + 1]; long long ans = 0; long long n; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> input[i]; for (int i = n - 2; i >= 0; i--) { if (input[i] > input[i + 1]) ans += input[i] - input[i + 1]; } cou...
// File ifchain.vhd translated with vhd2vl v2.4 VHDL to Verilog RTL translator // vhd2vl settings: // * Verilog Module Declaration Style: 1995 // vhd2vl is Free (libre) Software: // Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd // http://www.ocean-logic.com // Modifications Copyright (C) 2006 Mark...
// 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...
// -- (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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:57:49 04/12/2014 // Design Name: // Module Name: Test_module // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
/** * bsg_cache_to_axi_rx.v * * @author tommy */ `include "bsg_defines.v" module bsg_cache_to_axi_rx #(parameter `BSG_INV_PARAM(num_cache_p) ,parameter `BSG_INV_PARAM(data_width_p) ,parameter `BSG_INV_PARAM(block_size_in_words_p) ,parameter tag_fifo_els_p=num_cache_p ,parameter `BSG_INV_PARAM...
/** * 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 "assert.vh" `include "cpu.vh" module cpu_tb(); reg clk = 0; // // ROM // localparam MEM_ADDR = 6; localparam MEM_EXTRA = 4; localparam STACK_DEPTH = 7; reg [ MEM_ADDR :0] mem_addr; reg [ MEM_EXTRA-1:0] mem_extra; reg [ MEM_ADDR :0] rom_lower_bound = 0; reg ...
module sender(iClock, iReset, iTxDone, iStartSignal, oAddress, oFinished, oTxSend); parameter IDLE = 3'b000, SENDING = 3'b001, SEND_PACKET = 3'b010, // So serve para fazer o pulso de envio. SENDING_PACKET = 3'b011, INCREMENTING_ADDR = 3'b100, FINISHED_SENDING = 3'b101; input iClock; input iReset; input...
#include <bits/stdc++.h> using namespace std; int m[100005], v[100005], selected[100005]; vector<pair<pair<int, int>, int> > V; int k, n, h; bool check(long double time) { long double pos = 1.0; int id = 0; for (int i = 0; i < n; i++) { if (V[i].first.second * 1.0 * time >= pos * h) { ...
/* * 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 long long inf = 1100000000000000000; void solve() { long long n, k; cin >> n >> k; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long dp[k + 5][k + 5]; memset(dp, 0, sizeof(dp)); long long x =...
// 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 BfbIntersectionMutex //defines for state names used internall...
module omega_network_ff(clk, push, d_in, valid, d_out, control); parameter WIDTH = 8; parameter IN_PORTS = 8; parameter OUT_PORTS = IN_PORTS; parameter ADDR_WIDTH_PORTS = log2(OUT_PORTS-1); input clk; input [0:IN_PORTS-1] push; input [IN_PORTS*WIDTH-1:0] d_in; output [0:OUT_PORTS-1] val...
#include <bits/stdc++.h> const long long mod = 998244353; const long long inf = 1e18 + 10; using namespace std; long long modpow(long long a, long long b) { long long res = 1; while (b) { if (b % 2) { res *= a; } a *= a; res %= mod; a %= mod; b /= 2; } ...
#include <bits/stdc++.h> using namespace std; long long modexpo(long long x, long long p) { long long res = 1; x = x % 1000000007; while (p) { if (p % 2) res = res * x; p >>= 1; x = x * x % 1000000007; res %= 1000000007; } return res; } struct compare { bool opera...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: denise_hamgenerator_ram_mf.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =============...
#include <bits/stdc++.h> using namespace std; template <typename T, typename T1> T amax(T& a, T1 b) { if (b > a) a = b; return a; } template <typename T, typename T1> T amin(T& a, T1 b) { if (b < a) a = b; return a; } const long long N = 200005, INF = 2000000000000000000; void solve() ...
/* * 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 <iostream> #include <vector> #include <string> #include <algorithm> #include <utility> #include <set> #include <queue> #include <deque> #include <stack> #include <map> #include <math.h> #include <iomanip> #include <fstream> #include <bitset> #include <sstream> using namespac...
#include <bits/stdc++.h> using namespace std; const long long N = 100100, mod = 1e9 + 7, mod2 = 1e9 + 9, mod3 = 998244353, sq = 450, base = 727, lg = 30; long long n, m, x, y, z, w, ans, t, l[N], r[N]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (in...
#include <bits/stdc++.h> int main() { int a, b; scanf( %d %d , &a, &b); int diff, same, total; total = a + b; if (a > b) { diff = b; } else { diff = a; } same = (total - (2 * diff)) / 2; printf( %d %d n , diff, same); return 0; }
/* Distributed under the MIT license. Copyright (c) 2015 Dave McCoy () 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, mo...
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &t) { t = 0; char ch = getchar(); int f = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } do { (t *= 10) += ch - 0 ; ch = getchar(); } while ( 0 <= ch &&...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFLL = 1e18; const int MOD = 1e9 + 7; const int MAXN = 2e5 + 5; vector<int> G[MAXN]; int n; long long s[MAXN]; long long a[MAXN]; void dfs(int v, int p) { if (s[v] == -1) { long long aux = INF; ...
// -------------------------------------------------------------------------------- //| Avalon ST Idle Remover // -------------------------------------------------------------------------------- `timescale 1ns / 100ps module altera_avalon_st_idle_remover ( // Interface: clk input clk...
//LCD Code taken from John Loomis //Speakers code taken from Altera module control ( input CLOCK_50, input CLOCK_27, input [3:0] KEY, input [3:0] SW, output [17:0] LEDR, output [7:6] LEDG, output [2:0] GPIO_1, output [6:0] HEX7,HEX6,HEX5,HEX4,HEX3,HEX2,HEX1,HEX0, // LCD Module 16X2 output LCD_ON, output ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: dec_table.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ==============================...
#include <bits/stdc++.h> using namespace std; int main() { long long q; cin >> q; while (q--) { long long n, count = 0; cin >> n; long long a[100005]; for (int i = 0; i < n; i++) cin >> a[i]; if (n == 1) cout << 1 << endl; else { for (int i = 0; i < ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:36:03 02/26/2016 // Design Name: Register // Module Name: C:/Users/Ranolazine/Desktop/Lab/lab4/test_Register.v // Project Name: lab4 // Target Device: ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n; x = 1; y = n * n; while (x < y) { cout << x << << y << endl; x++; y--; } return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; const int inf = INT_MAX; const long long inff = 1e18; const long long mod = 1e9 + 7; vector<int> dx = {0, 1, 1, 1, 0, -1, -1, -1}; vector<int> dy = {1, 1, 0, -1, -1, -1, 0, 1}; int can[507][507]; set<pair<int, int> > second[32][9]...
#include <bits/stdc++.h> using namespace std; int const maxn = 1e6 + 5; int a[maxn], b[maxn]; pair<int, int> c[maxn]; int all_elem[2 * maxn]; int cur, inf = 1e9 + 7; int f[2 * maxn]; int psh[8 * maxn]; pair<int, int> imin[4 * maxn]; inline pair<int, int> unions(pair<int, int> c, pair<int, int> d) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t{}; cin >> t; while (t--) { long long int n{}; cin >> n; long long int a[n]; for (long long int i = 0; i < n; i++) cin >> a[i]; bool visit[n]; ...
#include <bits/stdc++.h> using namespace std; long long ans; int a, b, c, d, e, f, g; int main() { scanf( %d%d%d%d%d%d , &a, &b, &c, &d, &e, &f); if (e > f) ans += min(a, d); a -= ans, d -= ans; ans *= e; g = min(min(b, c), d); ans += f * g; b -= g, c -= g, d -= g; ans += e * min...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5010; int v[MAXN], n, k; int vec[1000100][12]; bool vis[1000100]; void crivo() { for (int i = 1; i <= 1000001; i++) { set<int> s; for (int j = 0; j <= 1000000; j += i) { for (int t = 1; t <= 11; t++) { int at = ...
#include <bits/stdc++.h> using namespace std; int T, n, cnt; struct poi { double x, y, alp; poi() {} poi(double x, double y) : x(x), y(y) { alp = atan2(y, x); } friend bool operator<(const poi &r1, const poi &r2) { return r1.alp < r2.alp; } friend poi operator+(const poi &r1, const p...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f;...
/** * 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; for (int i = 1; i <= n; i++) if (n == i * (i + 1) / 2) { cout << YES ; return 0; } cout << NO ; 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...
/** * 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(void) { char z[201], *p; const int H[] = {0, 1, 2, 3, 4, 2, 6, 7, 5, 6}; int s = 999, n = 2, Q[2][8] = {}; while (n--) for (gets(p = z); *p; ++Q[n][H[*p++ - 0 ]]) ; while (s && 8 ^ ++n) if (Q[1][n]) s = std::min(s, Q[0][n] / Q[1][n]); prin...
#include <bits/stdc++.h> using namespace std; int main() { int z = 0, f = 0, n, a; cin >> n; while (n--) { cin >> a; a == 0 ? z++ : f++; } if (z > 0 && f > 8) { f -= f % 9; while (f--) cout << 5 ; while (z--) cout << 0 ; cout << endl; } else if (z > 0) ...
#include <bits/stdc++.h> using namespace std; const double Pi = acos(-1), eps = 1e-10; int n, m, k, Q, id[100005], rt, siz[100005], f[100005]; int fir[100005], tot; int sgn(double x) { return x > -eps && x < eps ? 0 : 1; } struct node { double ang; int to, s; bool operator<(const node &p) const ...
#include <bits/stdc++.h> using namespace std; int n; int ara[200010]; string res; string str; void func(int le, int ri, int chk, int past) { if (res.size() < str.size()) { res = str; } if (le > ri) { return; } if (chk == 0) { if ((past < ara[le]) && (ara[le] < ara[ri]))...
#include <bits/stdc++.h> using namespace std; int main() { long long n, x; long long k, count = 0; char c; cin >> n >> x; for (int i = 1; i <= n; i++) { cin >> c >> k; if (c == + ) { x += k; } else { if (x >= k) { x -= k; } else { co...
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 2; int lis[N], where[N], length[N], link[N], a[N], b[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; } a[n] = INT_MAX; int m...
// Remodified for the course: Application of FPGA by Prof. Chu and Prof. Chen // Team mate: Wei cheng (³Ìΰ) // Institution: Zhejiang University // This module is designed for the course: Design of the digital system. // Author: Pengwei Wu // Teacher: Peiyong Zhang // ״̬»úÄ£ÐͲÉÓÿα¾ËùÊöµÄÁ½¸ö״̬»úÀ´Íê³É¡£(ÆäÊ...
/** * 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 : FPU_Interface.v // Created On : 2016-10-29 12:45:25 // Last Modified : 2016-10-30 15:01:39 // Revision : // Author : Jorge Sequeira Rojas // Company : Instituto Tecnologico ...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
`timescale 1ns / 100ps /* * The GPIA_DWORD module describes a 64-bit collection of GPIA_BITs. Each * octet of bits can be independently masked by its own stb_i input. */ module GPIA_DWORD( input clk_i, input res_i, input [1:0] mode_i, input [63:0] d_i, input [7:0] stb_i, output [63:0] q_o ); GPIA_BYTE byt...
/* * 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...
/*! memfifo -- implementation of EZ-USB slave FIFO's (input and output) a FIFO using the DDR3 SDRAM for ZTEX USB-FPGA Modules 2.13 Copyright (C) 2009-2014 ZTEX GmbH. http://www.ztex.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public Licen...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; const long long inf = 1e17; long long v[N]; long long c[N]; long long dp[N]; bool mark[N]; long long n, q; long long a, b; void solver() { cin >> a >> b; long long max1 = 0; long long color1 = 0; long long max...
#include <bits/stdc++.h> using namespace std; int main() { int t, i, j, curr, n; cin >> curr >> n; int arr[curr + 1]; int temp; arr[0] = 1; int count = curr - 1; for (i = 1; i <= curr; i++) arr[i] = 0; for (i = 0; i < n; i++) { cin >> temp; if (temp == 1) { int a,...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:54:55 11/18/2013 // Design Name: i2s_out // Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Proyecto Final/tec-drums/i2sgen_test.v // Project N...
/***************************************************************************** * * * Module: Altera_UP_SYNC_FIFO * * Description: * * ...
`timescale 1ns/1ps //----------------------------------------------------------------------------- // Title : DBG // Project : KPU //----------------------------------------------------------------------------- // File : dbg.v // Author : acorallo <> // Created : 08.06.2017 //------------------------------------...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:09:03 05/21/2016 // Design Name: // Module Name: Test // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ctu_top_rptr2.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...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; vector<long long> g[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while (t--) { long long n; cin >> n; string s; cin >> s; long long i, j; long long ans = ...
#include <bits/stdc++.h> int read() { int ans = 0, c, f = 1; while (!isdigit(c = getchar())) if (c == - ) f *= -1; do ans = ans * 10 + c - 0 ; while (isdigit(c = getchar())); return ans * f; } const int N = 10050; int n, A[N], B[N]; int m, a[N], b[N], c[N], d[N]; void por(int x1,...
//wishbone_interconnect.v /* Distributed under the MIT licesnse. Copyright (c) 2011 Dave McCoy () 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 ...