text
stringlengths
59
71.4k
////////////////////////////////////////////////////////////////////////////////// // // Author : Praveen Kumar Pendyala // Create Date : 05/27/13 // Modify Date : 16/01/14 // Module Name : pdl_block // Project Name : PDL // Target Devices : Xilinx Vertix 5, XUPV5 110T // Tool...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int n = s.size(); int cz = 0; int co = 0; int ct = 0; for (int i = 0; i < n; i++) { co += (s[i] == 1 ); ct += (s[i] == 2 ); ...
#include <bits/stdc++.h> using namespace std; const int NN = 100 * 1000 + 5; map<pair<pair<int, long long>, int>, long long> dp; vector<int> adj[NN]; vector<long long> x; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int mod = (int)1e9 + 7; int rec(int node, int pa...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int INF = 1000000007; const int MOD = 1000000007; const int MAXN = 100055; int dx[] = {2, 1, -1, -2, -1, 1, 2, 1, -1}; int dy[] = {0, 2, 2, 0, -2, -2, 0, 2, 2}; int main() { long long n; while (cin >> n) { n++; ...
module nkmd_arch #( parameter NKMDDBG_WIDTH = 16*8 )( input wire clk, input wire rst, input wire uart_rx, output wire uart_tx, input wire [23:0] dai_data_i, input wire dai_ack_i, output wire [23:0] dai_data_o, input wire dai_pop_i, output wire dai_ack_o, `ifdef PROMW ...
/* -- ============================================================================ -- FILE NAME : uart_ctrl.v -- DESCRIPTION : UARTÖÆÓù¥â¥¸¥å©`¥ë -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito ÐÂҎ×÷³É -- ====...
/** * 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...
/* * Wishbone switch and address decoder * Copyright (C) 2010 Zeus Gomez Marmolejo <> * Copyright (C) 2008, 2009 Sebastien Bourdeauducq - http://lekernel.net * Copyright (C) 2000 Johny Chi - * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modi...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<ll>; using pi = pair<int, int>; namespace output { void pr(int x) { cout << x; } void pr(long x) { cout << x; } void pr(ll x) { cout << x; } void pr(unsigned x) { cout << x; } void pr(unsi...
/* * 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...
function int hello(int a); begin $display("hello from unit 1"); hello = a; end endfunction task hello1; begin $display("hello1 from unit 1"); end endtask task hello2; begin $display("hello2 from unit 1"); end endtask task hello3; begin $display("hello3 from unit 1"); end endtas...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2006 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); // verilator lint_off MULTIDRIVEN ma ma0 (); i...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 1; int v[N], md[N]; vector<int> freq[N]; int lm[N], rm[N]; int cs[N]; int val(int x, int l, int r) { if (l > r || l < 0) return 0; return upper_bound(freq[x].begin(), freq[x].end(), r) - lower_bound(freq[x].begin(), freq[...
#include <bits/stdc++.h> using namespace std; int n, m, bal; string s, t; int main() { ios_base::sync_with_stdio(false); cin >> s; n = s.length(); bal = m = 0; for (int i = n - 1; i >= 0; --i) { if (s[i] == 0 ) --bal; else { if (bal + m >= 0) { int j = ...
#include <bits/stdc++.h> using namespace std; int main() { int x, v, arr[1000], c = 0; cin >> x >> v; for (int i = 0; i < x - 1; i++) { cin >> arr[i]; } while (1) { sort(arr, arr + x - 1); if (v > arr[x - 2]) break; arr[x - 2]--; v++; c++; } cout << c;...
// -*- Mode: Verilog -*- // Filename : fpga.v // Description : Prototype FPGA setup for SPI device // Author : Philip Tracton // Created On : Fri Jul 8 20:51:04 2016 // Last Modified By: Philip Tracton // Last Modified On: Fri Jul 8 20:51:04 2016 // Update Count ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c, d; cin >> a >> b >> c >> d; if ((a + b) % 2 == 0) { cout << Tidak Tidak ; if (b || c) cout << Ya ; else cout << Tidak ; if (a ...
/* * 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)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 do...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t ope...
/** * 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) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18 + 1; const int MAX = 200001; const long long MOD = 1000000007; struct trio { int first; int second; int third; }; struct long_trio { long long first; long long second; long long third; }; double dist_point...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int a, b, n; vector<int> div; cin >> a >> b >> n; if (b > a) swap(a, b); for (int d = 1; d * d <= b; d++) { if (a % d == 0 and b % d == 0) div.push_back(d); int d2 = -1; if (b % d =...
module memory( gm_or_lds, rd_en, wr_en, addresses, wr_data, input_tag, // wr_mask, rd_data, output_tag, ack, clk, rst ); input clk; input rst; input gm_or_lds; input rd_en, wr_en; input [31:0] addresses; input [31:0] wr_data; input [6:0] input_ta...
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, z[509], x[509], pi, g, s; vector<int> v[509]; bool m, rr; pair<int, int> p[509]; void dfs(int w) { if (m == 1) return; z[w] = 1; for (vector<int>::iterator it = v[w].begin(); it != v[w].end(); it++) { if (x[(*it)] == c) { ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1010; string a[MAX]; int n, m; bool visit[MAX][MAX]; bool v[1000010]; int b[MAX][MAX]; int val[1000010]; void dfs(int x, int y, int cnt) { if (x < 0 || y < 0 || x >= n || y >= m) { return; } if (visit[x][y]) { 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...
#include <bits/stdc++.h> using namespace std; int n, m, M; vector<set<int> > A; vector<set<pair<int, int> > > B; vector<int> d, f, F, G; vector<bool> v; inline void upd(int& a, int b) { if (d[a] > d[b]) a = b; } void ff(int x, int y) { f[x] = x, v[x] = 1; for (set<int>::iterator i = A[x].b...
// (C) 1992-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 simulati...
// ============================================================================= // COPYRIGHT NOTICE // Copyright 2006 (c) Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // This confidential and proprietary software may be used only as authorised by // a licensing agreement from Latt...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5050; int n, b, c[MAXN], d[MAXN], fa[MAXN], sum[MAXN], f[MAXN][MAXN], g[MAXN][MAXN]; int buff[MAXN], bufg[MAXN]; int main() { memset(f, 63, sizeof(f)); memset(g, 63, sizeof(g)); scanf( %d%d , &n, &b); for (int i = 1; i <= n; i++) {...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2008 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
#include <bits/stdc++.h> using namespace std; const int mn = 55; const int mm = 2505; const int mod = 1000000007; int n, m, T; int t[mm], g[mm]; int a[mn][mm]; int bc[mn][mn][mm]; int way[mn][mn][mn][3]; int cnt[3]; void init_a() { memset(a, -2, sizeof a); a[0][0] = 1; for (int k = 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 n; int A[101]; string s; long long d[101][101][101]; long long f(int lo, int hi, int p) { if (lo == hi) return A[p]; if (d[lo][hi][p]) return d[lo][hi][p]; long long ret = f(lo + 1, hi, 1) + A[p]; if (s[lo] == s[lo + 1]) ret = max(ret, f(lo +...
#include <bits/stdc++.h> using namespace std; void rom(long long W) { long long pot = 1LL; char val[20] = IVXLCDM ; long long w = 0LL, z, i; while (pot <= W) { pot *= 10LL; w++; } pot /= 10LL; w--; while (pot) { z = W / pot; if (z == 4) printf( %c%c ,...
#include <bits/stdc++.h> using namespace std; int c[4100]; int s[4100]; vector<long long> g; string str; int main() { long long a; cin >> a; cin >> str; int len = str.length(); for (int i = 0; str[i]; i++) c[i + 1] = str[i] - 0 ; for (int i = 1; i <= len; i++) { s[i] = s[i - 1...
#include <bits/stdc++.h> using namespace std; int n, q, A[1005], B[1005], x, y; int main() { scanf( %d %d , &n, &q); for (int i = 1; i <= q; i++) { scanf( %d %d , &x, &y); A[x] = 1; B[y] = 1; } int cev = 0; for (int i = 2; i < n; i++) { cev += !A[i] + !B[i]; } 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...
//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...
//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...
module peripheral_audio(clk , rst , d_in , cs,wr,rd , addr, d_out, mclk, ledres, micLRSel,micData ); input clk; input rst; input [15:0] d_in; input cs; input wr; input rd; input [3:0]addr; // 4 LSB from j1_io_addr output reg [15:0]d_out; output ledres; output mclk; output micLRSel; input micDa...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2020 by Peter Monsson. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; wire gain = 1'b0; re...
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sctag_dir_in.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; int f[150000]; int find(int x) { if (x == f[x]) return f[x]; else { return f[x] = find(f[x]); } } int a[150000]; int num[150000]; int main() { ios::sync_with_stdio(false); int n, m; while (cin >> n >> m) { memset(a, 0,...
//---------------------------------------------------------------------------- //-- Ejemplo que saca una secuencia en los leds, usando una memoria //-- rom de 16x4 //------------------------------------------ //-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan) //-- GPL license //------------------------------...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int i, j, n, m, k, l, r; cin >> n >> m; int a[n][m]; pair<int, int> start_end[n][m]; for (i = 0; i < n; i += 1) for (j = 0; j < m; j += 1) { cin >> a[i][j]; start_end[i][j].first = i; ...
#include <bits/stdc++.h> char s[128]; bool ce(char r, char a, char b, char c) { return r == a || r == b || r == c; } bool spcmp(char a, char b, char c) { return ce( A , a, b, c) && ce( B , a, b, c) && ce( C , a, b, c); } int main() { int n, i; scanf( %s , s); for (i = 1; s[i + 1] != 0 ; i++)...
#include <bits/stdc++.h> using namespace std; pair<long long, long long> add_pair(pair<long long, long long> a, pair<long long, long long> b) { return make_pair(a.first + b.first, a.second + b.second); } long long power(long long a, long long b) { long long res = 1;...
/* * PS2 Mouse without FIFO buffer * Copyright (C) 2010 Donna Polehn <> * * This file is part of the Zet processor. This processor is free * hardware; 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...
#include <bits/stdc++.h> using namespace std; long long ab(long long x) { return x > 0LL ? x : -x; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, k, sum = 0, x; cin >> n >> k; vector<long long> v; for (long long i = 0; i < n; i++) { cin >> x; ...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000000 + 7; int main() { long long a, b; cin >> a >> b; long long ans = 0; for (long long r = 1; r < b; ++r) { long long tmp = (a * (a + 1) / 2) % mod; tmp = (tmp * r) % mod; tmp = (tmp * b) % mod; tmp = (tmp...
/* * 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 n; float sum = 0; cin >> n; int k[n], count = 0; float a[n]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) sum += a[i]; for (int i = 1; i <= n; i++) { if ((sum - a[i]) / (n - 1) == a[i]) { ...
#include <bits/stdc++.h> using namespace std; int main() { int f, a, b; scanf( %d , &f); scanf( %d:%d , &a, &b); if (b > 59) b %= 10; if (a > f or a == 24) a %= 10; if (a == 0 and f == 12) a = 10; printf( %02d:%02d , a, b); }
module alt_vipitc131_common_sync_generation( input wire rst, input wire clk, input wire clear_enable, input wire enable_count, input wire hd_sdn, input wire start_of_vsync, input wire field_prediction, input wire interlaced, input wire [13:0] total_sample_count, input wire t...
`define ADDER_WIDTH 015 `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,...
#include <bits/stdc++.h> using namespace std; pair<long long, long long> a[5]; long long k; int main() { for (long long i = 1, _b = (2); i <= _b; i++) cin >> a[i].first >> a[i].second; cin >> k; sort(a + 1, a + 2 + 1); if (a[1].second < a[2].first) return cout << 0, 0; long long res = ...
#include <bits/stdc++.h> using namespace std; vector<int> V; void initSet(int _size) { V.resize(_size); for (int i = int(0); i <= int(_size - 1); i++) V[i] = i; } int findSet(int i) { return (V[i] == i) ? i : (V[i] = findSet(V[i])); } void unionSet(int i, int j) { V[findSet(i)] = findSet(j); } boo...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1E9 + 7; const long long N = 2E5 + 6; long long n, m, a[N], b[N], ans, zeros[N]; long long dp[N]; long long modexp(long long b, long long e) { long long res = 1; while (e) { if (e & 1) res = (res * b) % MOD; e >>= 1; ...
#include <bits/stdc++.h> using namespace std; string grid[60]; int main() { cin.tie(0); ios::sync_with_stdio(0); int t; cin >> t; int r, c; while (t--) { cin >> r >> c; for (int i = 0; i < r; i++) cin >> grid[i]; bool quina = false, borda = false, meio = false, all = true...
#include <bits/stdc++.h> using namespace std; const int Maxn = 4010; double num1[Maxn]; int num2[Maxn]; double dif[Maxn]; int main() { int n = 0, N = 0; int cnt = 0, cnt1 = 0, cnt2 = 0; double sum = 0; double ans = 100000000.0; scanf( %d , &n); N = 2 * n; for (int i = 0; i < N; i...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); cin.sync_with_stdio(0); long long n, a[5001], cnt = 1, maxn = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n - 1; i++) { if (a[i] == a[i + 1]) cnt++; if (a[i] !...
#include <bits/stdc++.h> using namespace std; int p[2010]; int main(void) { int N, ans = 0, i, j; cin >> N; for ((i) = 0; (i) < (int)(N); (i)++) cin >> p[i]; for ((i) = 0; (i) < (int)(N); (i)++) if (p[i] < 0) p[i] = -p[i]; for ((i) = 0; (i) < (int)(N); (i)++) { int a = 0, b = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[100000]; for (int i = 0; i < n; i++) cin >> a[i]; long long ans = 0; for (int i = 0; i < n - 1; i++) { int j = 1; while (i + j * 2 < n) j *= 2; ans += a[i]; a[i + j] += a[i]; cout ...
module meio_somador2 ( a, b, soma, cout); input a, b; output soma, cout; assign soma = a ^ b; assign cout = a * b; endmodule module meio_somador3 ( a, b, c, soma, cout); input a, b, c; output soma, cout; wire carry_1, carry_2, soma_1; meio_somador2 m1 ( a, b, soma_1, carry...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: reading.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ============================...
/// date:2016/3/5 3/6 am: 10:57 done! /// engineer:ZhaiShaoMIn /// module function:because there are three kinds of uploadregs to /// OUT_req: inst_cache ,data_cache and memory, so we need to determine which can be writed into OUT_req. module arbiter_for_OUT_req(//input clk, ...
#include <bits/stdc++.h> using namespace std; pair<int, int> a[300005]; int n, x, y; void resi(int x, int y, bool naopako) { int z = 0, j = -1, k = -1, c = 0; for (int i = 1; i <= n; i++) { z = a[i].first; c++; if (j == -1 && z * c >= x) { j = i; z = c = 0; } ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 555; int n, m; int a[maxn], b[maxn]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , a + i); for (int i = 1; i <= m; i++) scanf( %d , b + i); int i1 = 1, i2 = 1; int res = 0; while (i1 <= ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distribut...
/* * 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 p[500005], q[500005], c[500005], f[500005], siz[500005], fx[500005], sizx[500005], cln[500005 * 2], ans[500005], qu[500005], id[500005]; struct edge { int u, v, w, nxt, id; } e[500005]; vector<int> a[500005]; inline int find(int); void swap(int& ...
#include <bits/stdc++.h> using namespace std; char s[1309]; bool a[5201][5201]; int n, i, j, k, f, dp[2][5201][5201]; int main() { for (scanf( %d , &n), i = 1; i <= n; ++i) for (scanf( %s , s), j = 0; s[j]; k = s[j] - ( 9 < s[j] ? A - 10 : 0 ), a[i][(j << 2) + 1] = 8 &...
/***************************************************************************** * File : processing_system7_bfm_v2_0_intr_wr_mem.v * * Date : 2012-11 * * Description : Mimics interconnect for Writes between AFI and DDRC/OCM * *****************************************************************************/ `timesca...
// NOTE: This test program is WRONG, in that it ignores the fact // that continuous assigns drive with their own strength and drop // any strength that the r-value may have. module strength(); wire sup1; assign (supply0, supply1) sup1 = 1'b1; wire str1; assign (strong0, strong1) str1 = 1'b1; wire pl1; assign (pull0,...
#include <bits/stdc++.h> using namespace std; int a[610000], i, j, k, l, n, m, p[610000], t, last, o, r, mid; char c[610000]; bool check(int mid) { int tmp = 1e9, res = 0; p[0] = mid; m = last; for (i = 1; i <= n; ++i) { p[i] = p[i - 1] + a[i]; if (p[i] == 0 && p[i - 1] == -1) m = ma...
#include <bits/stdc++.h> using namespace std; struct node { int leftColors[10], rightColors[10]; int leftParent[10], rightParent[10]; int components; node() { components = 0; } }; int n; node merge(node l, node r) { node ans; ans.components = l.components + r.components; for (int e...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long t; cin >> t; while (t--) { long long n, k; cin >> n >> k; long long d = (k / (n - 1)), r = (k % (n - 1)); if (r != 0) { cout <...
#include <bits/stdc++.h> using namespace std; string s; string name, host, sour; int main() { ios::sync_with_stdio(false); cin >> s; int i = 0; while (i < s.size() && s[i] != @ ) { name.push_back(s[i]); i++; } i++; while (i < s.size() && s[i] != / ) { host.push_ba...
/** * 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 c, hi, hb, wi, wb; inline long long f(int x) { long long k1 = x; long long k2 = 1ll * (0ll + c - 1ll * x * wi) / wb; return k1 * hi + k2 * hb; } int main() { cin >> c >> hi >> hb >> wi >> wb; int kek1 = c / wi; int l = 0; int r = ke...
#include <bits/stdc++.h> using namespace std; int main() { long long i, n, m; while (cin >> n) { m = n; for (i = 1; i < n; i++) { if (m <= i) break; m = m - i; } cout << m << endl; } return 0; }
/* * Verify that the continuous assignments support a delay that is * greater than 32 bits. The top delays are in seconds and the other * delays are in ps. The second delays all require more than 32 bits * to work correctly. They will use the /d version. */ `timescale 1s/1s module gt32b; wire real rlval; wire...
#include <bits/stdc++.h> using namespace std; const int N = 100010; const int mod = 1e9 + 7; const int M = 2010; pair<int, int> p[M]; int n, m, k, s, x, y, cnt; int fac[2 * N], inv[2 * N], K[30], f[M][30]; bool pd1, pd2; int Pow(int a, int b) { if (b == 0) return 1; int ret = Pow(a, b / 2); ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); double d, L, v1, v2; cin >> d >> L >> v1 >> v2; double distance; int i, r; cout << fixed << setprecision(20) << (L - d) / (v1 + v2); return 0; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:45:53 04/11/2014 // Design Name: // Module Name: add_32bit // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Case Western Reserve University // Engineer: Matt McConnell // // Create Date: 10:40:00 09/11/2017 // Project Name: EECS301 Digital Design // Design Name: Lab #3 Project // Module Name: ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
/** * 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; void cp() { ios ::sync_with_stdio(false); cin.tie(0); cout.tie(0); } long long power(long long x, long long y) { long long res = 1; while (y > 0) { if (y & 1) res = res * x; y = y >> 1; x = x * x; } return res; } int...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:167772160000 ) using namespace std; long long dp[5100][5100]; long long x[5100]; int a[5100], b[5100], c[5100], d[5100]; int main() { int leftminright = 0; int n, s, e; cin >> n >> s >> e; s--; e--; for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int n, bin[35], f[35][35][2]; void updata(int &x, int y) { x += y; x -= x >= MOD ? MOD : 0; } int main() { scanf( %d , &n); bin[0] = 1; for (int i = 1; i <= 30; i++) bin[i] = bin[i - 1] * 2; for (int i = 30; i ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 1; i <= t; i++) { int x1, x2, y1, y2; string arr[8]; for (int i = 0; i < 8; i++) cin >> arr[i]; bool check = 0; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { ...
#include <bits/stdc++.h> int a[200001]; int renew[200001]; int payoff[200001]; int maxpay[200001]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , a + i); int q; scanf( %d , &q); for (int i = 0; i < q; i++) { int mode; scanf( %d , &mode); ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; int n, a[MAXN * 3], u[MAXN * 3], v[MAXN * 3], front, rear; int main() { int Q; long long x; scanf( %d%d , &n, &Q); front = 1; rear = n; for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= 2 * n -...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * adjusted to FML 8x16 by Zeus Gomez Marmolejo <> * * 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, version 3...