text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long k, l; int main() { cin >> k >> l; long long K = k; int res = 0; while (K < l) { K *= k; res++; } if (K == l) { cout << YES << endl; cout << res << endl; } else { cout << NO << endl; } retu...
/* * 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 read() { int x = 0; char c = getchar(); while (c < 0 || 9 < c) c = getchar(); while ( 0 <= c && c <= 9 ) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return x; } int p[200000 + 5]; int tp, stk[200000 + 5]; int U[200000 +...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5, Mod = 1e9 + 7; struct Edge { int nxt, to; } e[maxn << 1]; int hd[maxn], e_cnt = 1; void add(int u, int v) { e[++e_cnt] = (Edge){hd[u], v}; hd[u] = e_cnt; } int n, pre[maxn << 2], nxt[maxn << 2], p[maxn], dep[maxn], fac[m...
#include <bits/stdc++.h> using namespace std; int const N = 202020; long long a[N]; long long l[N], r[N]; int main() { int n; long long k; scanf( %d%I64d , &n, &k); for (int i = 1; i <= (n); ++i) scanf( %I64d , &a[i]); for (int i = 1; i <= (n); ++i) l[i] = a[i - 1] == 1 ? 1 + l[i - 1] : 0;...
#include <bits/stdc++.h> using namespace std; int h, m, n; void input() { scanf( %d%d%d , &h, &m, &n); } set<int> s; int head[200010], tail[200010], cnt[200010], idx[200010], nid; void build() { for (int i = 0; i < h; i++) s.insert(i); memset(idx, -1, sizeof(idx)); memset(tail, -1, sizeof(tail))...
/* * 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 // // Validates that updating a pattern works according to design. // // In testing on the hardware, PuTTY was having trouble reliably sending and // receiving the lowercase letter 'a'. Nothing else; the test data here worked // fine. So this variation attempts to figure out why. // Wait a rando...
#include <bits/stdc++.h> using namespace std; const long long logN = 20; const long long M = 1000000007; const long long INF = 1e12; const long long N = 505; const long long K = 250505; long long dp[K]; void solve() { long long n, k; cin >> n >> k; long long A[n], B[n]; for (long long i ...
#include <bits/stdc++.h> using namespace std; long long a, b; int main() { cin >> a >> b; long long v = (a * (a + 1) / 2) % 1000000007; long long rs = b * (b - 1) / 2; rs %= 1000000007; long long res = 0; for (long long i = 1; i <= a; ++i) res = (res + rs * (i * b % 1000000007 + 1) %...
//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...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License...
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; long long ln, lk, lm; const int MN = 10000; int mod; char s[505][505]; pair<int, int> id[2][MN], rid[505][505]; int sz[2]; vector<int> mp[MN], mpc[MN]; long long A[505][50...
#include <bits/stdc++.h> long long x, y; int maxdis(long long x, long long n, long long s) { if (x > (s >> 1)) x = s - x; if (x * n > s) return maxdis(s % x, (x * n + s % x) / s, x); else return (x > (s - x * (n - 1)) ? x : (s - x * (n - 1))); } int a, n, p, h; int main() { int t; ...
/** * 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 maxn = 3e5 + 10; const int maxm = 3e5 + 10; vector<pair<int, int> > g[maxn]; stack<int> S; struct edge { int x, y; } e[maxm]; int n, m, cnt, dfn; int d[maxn], low[maxn], fa[maxn], pre[maxn]; void tarjan(int now, int f) { d[now] = low[no...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; vector<int> divs[1000009]; bool p[1000009]; vector<int> primes; void pre() { for (int i = 2; i <= (1000000); ++i) { if (!p[i]) { primes.push_back(i); for (int j = i; j <= 1000000; j += i) divs[j].push_back(i), p[j] = true; } } ...
/** * 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 h1, m1, h2, m2, s1, s2, h, m; scanf( %d:%d , &h1, &m1); scanf( %d:%d , &h2, &m2); s1 = h1 * 60 + m1; s2 = h2 * 60 + m2; m = (s1 + s2) / 2; h = m / 60; m = m % 60; printf( %02d:%02d n , h, m); return 0; }
module system_bus( input wire clk, input wire rst, // MEMORY output reg [ 7:0] cpu_data_i, input wire [ 7:0] cpu_data_o, input wire cpu_rw, input wire cpu_vma, // input wire cpu_oe_o, input wire [ 7:0] memory_data_o, input wire [15:0] address, output wire ram_cs, // UART input...
#include <bits/stdc++.h> using namespace std; inline int read() { int sum = 0, p = 1; char ch = getchar(); while (!(( 0 <= ch && ch <= 9 ) || ch == - )) ch = getchar(); if (ch == - ) p = -1, ch = getchar(); while ( 0 <= ch && ch <= 9 ) sum = sum * 10 + ch - 48, ch = getchar(); return s...
module serial_tx #( parameter CLK_PER_BIT = 50, parameter CTR_SIZE = 6 )( input clk, input rst, output tx, input block, output busy, input [7:0] data, input new_data ); localparam STATE_SIZE = 2; localparam IDLE = 2'd0, START_BIT = 2'd1, DATA = 2'd2, STOP_BIT = 2'd3; reg [CTR_SIZE-1:...
module TimeHoldOver_Qsys ( clk_clk, epcs_flash_controller_dclk, epcs_flash_controller_sce, epcs_flash_controller_sdo, epcs_flash_controller_data0, on_chip_rst_and_pps_switch_export, io_update_ctrl_export, ocxo_lock_export, pps_interrupt_export, reset_reset_n, sdram_controller_addr, sdram_controller_ba, sd...
#include <bits/stdc++.h> int main() { int n; int x; int sum = 0; std::cin >> n; std::cin >> x; unsigned int t1 = 0, t2 = 0, tcurr = 1; for (int i = 0; i < n; i++) { std::cin >> t1; std::cin >> t2; sum += (t1 - tcurr) % x + t2 - t1 + 1; tcurr = t2 + 1; } std:...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using std::bitset; using namespace std; struct point { long long x, y; bool operator<(const point &I) const { return x < I.x || (x == I.x && y < I.y); } } a[101000]; long long n; long long hmi[101000], tmi[101...
/* * Redistributions of any form whatsoever must retain and/or include the * following acknowledgment, notices and disclaimer: * * This product includes software developed by Carnegie Mellon University. * * Copyright (c) 2004 by Babak Falsafi and James Hoe, * Computer Architecture Lab at Carnegie Mellon (CALCM),...
#include <bits/stdc++.h> using namespace std; const int MAX = 100002; map<int, int> cnt[MAX]; vector<int> adj[MAX]; long long ans[MAX]; int color[MAX]; int max_el[MAX]; void dfs(int node, int par) { cnt[node][color[node]] = true; max_el[node] = 1; ans[node] = color[node]; for (int i = 0;...
#include <bits/stdc++.h> int n; int tot; int top; int tot1; int a[2005][2005]; int stack[2005]; int instack[2005]; int visit[2005]; int dfn[2005]; int low[2005]; inline void tarjan(int u) { if (visit[u]) return; int v; dfn[u] = low[u] = ++tot; stack[++top] = u; instack[u] = 1; ...
#include <bits/stdc++.h> using namespace std; int x, y, a, b, num_of_results; pair<int, int> game, results[10101]; int main() { scanf( %d %d %d %d , &x, &y, &a, &b); num_of_results = 0; if (b >= x) printf( 0 n ); else { for (int i = a; i <= x; i++) { for (int j = b; j <= y; j...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2009 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t; //Several simulators don't support this. //typedef struct pack2; // Forward declarat...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n); vector<int> B(n, 1); for (int i = 0; i < n; i++) { cin >> A[i]; } int max1 = B[0]; for (int i = 1; i < n; i++) { if (A[i] >= A[i - 1]) { B[i] = B[i - 1] + 1; } ...
/*************************************************************** ** Author: Oswaldo Cadenas () ** Date: September 26 2011 ** ** Test: Intended to test a system composed of some parametric system ** that has an adder, a register and an incrementer ** Each module has parameter: N for data length ** ** A syste...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; const int maxn = 2e5 + 100; const int mod = 998244353; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); ll fact[maxn], inv[maxn]; ll pwr(ll a, ll pw) { ...
#include <bits/stdc++.h> using namespace std; long long cd, w, a, b, kq = 0, mod = 1e9 + 7, fact[1000001], sf[1000001], p[1000001]; void inp() { cin >> cd >> w >> a >> b; } long long bigmod(long long hat, long long base) { if (hat == 0) return 1; long long k = bigmod(hat / 2, 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...
//name : real_main //tag : c components //source_file : test.c ///========= /// ///*Created by C2CHIP* // Register Allocation // =================== // Register Name Size // 0 real_main return address 2 `timescale 1ns/...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int i, cnt = 0; for (i = 0; i < s.size(); i++) { if (s[i] == x && s[i + 1] == x && s[i + 2] == x && i < n - 2) cnt++; } cout << cnt << endl; }
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 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 distributed in ...
/* * Copyright (c) 2000 Mark Schellhorn <> * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_84x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ===========================================...
#include <bits/stdc++.h> using namespace std; const int MAXN = 0; const int LOGN = 0; const int MOD = 1e9 + 7; const int INF = 1e9 + 10; long long N, Q; long long x; long long f(long long x) { if (x & 1) return (x + 1) >> 1; long long id = N - (x >> 1); while (!(id & 1)) id >>= 1; id >>=...
#include <bits/stdc++.h> using namespace std; int n; int main() { pair<long long, long long> s, e; long long t; cin >> t; cin >> s.first >> s.second >> e.first >> e.second; map<char, int> mp; string str; cin >> str; for (int i = 0; i < t; ++i) { mp[str[i]]++; } char 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...
module testbench_4 (); parameter START_ADDR = 32'h8002_0000; // h80020000 reg clk; reg [31:0] addr; reg [31:0] din; reg enable; reg rw; reg [1:0] access_size; reg test_mode; reg [31:0] int_addr; wire [31:0] dout; wire busy; mips_memory2 test_memory(.clk(clk), .addr(...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:45:38 09/23/2013 // Design Name: // Module Name: Clock_Divider // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
#include <bits/stdc++.h> using namespace std; int n, a[1003], d, u, e; vector<int> v1, v2, v3; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] < 0) v1.push_back(a[i]); if (a[i] > 0) v2.push_back(a[i]); if (a[i] == 0) v3.push_back(a[i]); } if (v2...
//---------------------------------------------------------------------------- //-- Asynchronous serial transmitter Unit //------------------------------------------ //-- Juan Gonzalez (Obijuan) //-- GPL license //---------------------------------------------------------------------------- //-- Tested at all the standa...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int *p = new int[100010]; fill(p, p + 100010, -1000000000); for (int i = 0; i < n; ++i) { int x, y; int res = 0; scanf( %d%d , &x, &y); int q = (int)sqrt((double)x); for (int j = 1; j <= q; ...
/* * File: imx_uocm.v * Project: pippo * Designer: kiss@pwrsemi * Mainteiner: kiss@pwrsemi * Checker: * Description: * general purpose synchronous single-port memory * Notes: * 1, currently signal "oe" is NOT driven by this module, it should be used by * memory cont...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); vector<int> lucky; for (int i = 1; i <= 9; i++) { for (int j = 0; j < (1 << i); j++) { int num = 0; for (int k = 0; k < i; k++) { if (j & (1 << k)) num ...
/** * 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() { deque<int> dq; int n; cin >> n; int f = 0, a = 0, b = 0; for (int i = 0; i < n; ++i) { int x; cin >> x; dq.push_back(x); } while (!dq.empty()) { int ans = max(dq.front(), dq.back()); if (f == 0) { ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 650; int kd[MAXN], edges[100010][2]; int idA[MAXN], idB[MAXN]; int g[MAXN][MAXN]; int P; inline int advPow(int a, int b) { int ret = 1; while (b) { if (b & 1) ret = (long long)ret * a % P; a = (long long)a * a % P; 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...
`include "common.h" `default_nettype none module execute_branch_predict( //State input wire iSTATE_NORMAL, //Previous - PREDICT input wire iPREV_VALID, input wire iPREV_EX_BRANCH, input wire iPREV_BRANCH_PREDICT_ENA, input wire [31:0] iPREV_BRANCH_PREDICT_ADDR, //JUMP input wire iPREV_BRANCH_VALID...
#include <bits/stdc++.h> using namespace std; const int maxn = 404; int n, m; vector<int> g[maxn]; vector<int> q, G; int dis[maxn][maxn]; long double p[maxn], P; pair<long double, int> mxp[maxn]; long double ans; void bfs(int s) { dis[s][s] = 0; q.resize(0); q.push_back(s); for (int ...
#include <bits/stdc++.h> using namespace std; int a[110]; int r; void solve(int x) { r = 0; while (x) { a[r++] = x % 3; x /= 3; } } int main() { int t; scanf( %d , &t); while (t--) { memset(a, 0, sizeof a); int n; scanf( %d , &n); solve(n); a...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 20; const int inf = 0x3f3f3f3f; const int modd = 1e9 + 7; inline int read() { int x = 0, f = 1; char c = getchar(); while (c != - && (c < 0 || c > 9 )) c = getchar(); if (c == - ) f = -1, c = getchar(); while (c >= ...
#include <bits/stdc++.h> using namespace std; bool isv(char x) { if (x == a || x == e || x == i || x == o || x == u ) return true; return false; } int main() { ios::sync_with_stdio(0); long long c, a, b, act; cin >> c; cin >> a >> b; act = max(a, b); --c; while (c--)...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * T...
`default_nettype none //module scheduler2_allocate_rsv_station( module regist_rbuffer_select( input wire iORDER_LOCK, input wire iORDER_0_VALID, input wire iORDER_0_EX_SYS_REG, input wire iORDER_0_EX_SYS_LDST, input wire iORDER_0_EX_LOGIC, input wire iORDER_0_EX_SHIFT, input wire iORDER_0_EX_ADDER, ...
/* * 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, m, s = 0; bool kt; cin >> n >> m; char a[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int i = 0; i < n; i++) { kt = true; for (int j = 0; j < m...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, mxn = 2e5 + 5; int n; int a[200005]; int mp1[200005], mp2[200005]; map<int, int> mp; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void Int(T &n) { n = 0; int f = 1; register int ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -1; for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - 0 ; n = n * f; ...
#include <bits/stdc++.h> using namespace std; const long long int N = 200010; const long long mod = 1000000007; const long long inf = 1000000000000000000; const long double pi = 3.14159265358979323846264338; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n; ci...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: letterf.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ============================...
#include <bits/stdc++.h> using namespace std; pair<double, double> p[100100]; double d[100100]; double dist(pair<double, double> x, pair<double, double> y) { double val = pow((x.first - y.first) * (x.first - y.first) + (x.second - y.second) * (x.second - y.second), ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const double eps = 1e-10; const int INF = 0x3f3f3f3f; const long long INFLL = 0x3f3f3f3f3f3f3f3fll; const int MAXN = 2e5 + 5; const int mod = 1e9 + 7; int a[MAXN], b[MAXN]; long long fastpow(long long a, int n) { long long base...
/** * Decodes the ps2 data into scan codes. * * The ps2 protocol is here http://www.computer-engineering.org/ps2protocol/ */ module ps2_controller ( input reset, input clk, input ps2_clock, input ps2_data, output scan_ready, output [7:0] scan_code ); reg [7:0] r_scan_code; reg ...
#include <bits/stdc++.h> using namespace std; int n, m, k, key, MK, MKEY; int MAP[110][110]; int ii, jj; void dfssolve(int pos, int step) { int temp[110]; int cnt, i, j; if (pos > n) { key = 1; k = k < step ? k : step; return; } cnt = 0; for (i = 1; i <= m; ++i) { ...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.4 (win64) Build Tue Nov 18 18:29:27 MST 2014 // Date : Tue Jun 30 15:23:02 2015 // Host : Vangelis-PC running 64-bit major release (...
//***************************************************************************** // (c) Copyright 2009 - 2010 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 /...
#include <bits/stdc++.h> using namespace std; ifstream fin( Sisend.txt ); long long t, n, m, arv; string s[105]; vector<int> v; void pane(int i1, int j1, int i2, int j2, int i3, int j3) { v.emplace_back(i1 + 1), v.emplace_back(j1 + 1), v.emplace_back(i2 + 1), v.emplace_back(j2 + 1), v.emplace_ba...
module sep24 #(parameter width=10, parameter pos0=5'd0) ( input clk, input clk_en, input [width-1:0] mixed, input [23:0] mask, input [4:0] cnt, output reg [width-1:0] ch0s1, output reg [width-1:0] ch1s1, output reg [width-1:0] ch2s1, output reg [width-1:0] ch3s1, output reg [width-1:0] ch4s1, output reg ...
#include <bits/stdc++.h> using namespace std; int main() { pair<int, int> p[100000]; int n, ans = 0, a, k, c = 0, i; scanf( %d %d , &n, &k); for (i = 0; i < n; i++) scanf( %d , &a), p[i] = make_pair(a, i); sort(p, p + n); for (i = 0; i < n; i++) { if ((p[i].first + ans) <= k) c++, ans ...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 // Date : Sun Mar 8 22:11:52 2015 // Host : edinburgh running 64-bit Ubuntu 14.10 // Co...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Iztok Jeras. module t (/*AUTOARG*/); logic [3:0] array_simp [1:0] [3:0]; // big endian array initial begin array_simp[0] = '{ 4'd3, 4'd2, 4'd1, 4'd0}; if ...
#include <bits/stdc++.h> using namespace std; int read() { int q = 0; char ch = ; while (ch < 0 || ch > 9 ) ch = getchar(); while (ch >= 0 && ch <= 9 ) q = q * 10 + ch - 0 , ch = getchar(); return q; } const int N = 200005, inf = 0x3f3f3f3f; int n, m, Q, SZ, st_top, tim; int w[...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE revB.2 compliant I2C Master controller Top-level //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { long long val; cin >> val; if (val & 1) cout << 1 << endl; else cout << 2 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int n, m, dp[25][1100000], ans = 1e9; char num[25][100005]; int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) scanf( %s , num[i] + 1); for (int i = 1; i <= m; ++i) { int t = 0; for (int j = 1; j <= n; ++j) t = t * 2 + num[j][i] - 0 ; ...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. parameter WIDTH_START = 2'b00; parameter WIDTH_CKMIN = 2'b01; parameter WIDTH_CKMAX = 2'b10; parameter WIDTH_IDLE = 2'b11; reg r_test_expr; reg [1:0] r_state; integer num_cks; `ifdef ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; vector<int> g[maxn]; int father[maxn]; int a[maxn]; int findfather(int x) { int a = x; while (x != father[x]) x = father[x]; while (a != father[a]) { int z = a; a = father[a]; father[z] = x; } ret...
#include <bits/stdc++.h> using namespace std; int n, d1, d2; bool d[400001]; int a[200001]; int nextprime(int x) { for (int i = x + 1; i <= 2 * n; ++i) if (d[i]) return i; return 2 * n + 1000000; } int main() { ios_base::sync_with_stdio(0); cin >> n; int x; for (int i = 1; i ...
`timescale 1 ns / 1 ps module axis_bram_reader # ( parameter integer AXIS_TDATA_WIDTH = 32, parameter integer BRAM_DATA_WIDTH = 32, parameter integer BRAM_ADDR_WIDTH = 10, parameter CONTINUOUS = "FALSE" ) ( // System signals input wire aclk, input wire ...
#include <bits/stdc++.h> using namespace std; long long n, x, summ; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> x; summ += (x - 1); if (summ % 2) cout << 1 << endl; else cout << 2 << endl; } }
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; namespace BF { long long solve(int N, int M, int K, const vector<int>& T, const vector<int>& A, const vector<int>& B) { long long res = INF; for (int mask = 0, _n = (1 << N); mask < _n; ++mask) { if ((__bui...
#include <bits/stdc++.h> using namespace std; double a, b, m; double vx, vy, vz; double x0, z0; int main() { scanf( %lf %lf %lf , &a, &b, &m); { scanf( %lf %lf %lf , &vx, &vy, &vz); double t = -(m / vy); double sx = vx * t; double sz = vz * t; int d = (int)(sz / b); ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:22:03 09/12/2015 // Design Name: Counter // Module Name: Z:/share/ISE/CPUFly/tests/Counter_test.v // Project Name: CPUFly // Target Device: // Tool versions: ...
/* ---------------------------------------------------------------------------------- Copyright (c) 2013-2014 Embedded and Network Computing Lab. Open SSD Project Hanyang University All rights reserved. ---------------------------------------------------------------------------------- Redistribution and use ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_aa_e // // Generated // by: wig // on: Wed Aug 18 12:44:01 2004 // cmd: H:/work/mix_new/MIX/mix_0.pl -strip -nodelta ../../constant.xls // // !!! Do not edit this file! Autogenerated by MIX !!!...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { long long a, b, k; cin >> a >> b >> k; if (k % 2 == 0) cout << a * (k / 2) - b * (k / 2) << n ; else ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int biceps = 0, back = 0, chest = 0; for (int i = 0; i < n; i++) { int a; cin >> a; if (i % 3 == 0) chest += a; if (i % 3 == 1) biceps += a; if (i % 3 == 2) back += a; } if (chest > back...
#include <bits/stdc++.h> using namespace std; int n; vector<string> s; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; s.resize(n); for (int i = 0; i < n; i++) cin >> s[i]; for (int i = n - 1; i > 0; i--) { int l = 1, r = min(s[i].length(), s[i - 1].length()); ...
// 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 : Mon Feb 27 15:47:58 2017 // Host : GILAMONSTER running 64-bit major release (...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:30:32 03/24/2014 // Design Name: // Module Name: rom // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Rev...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * * */ `timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the tim...