text
stringlengths
59
71.4k
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Tecnológico de Costa Rica // Engineer: Juan José Rojas Salazar // // Create Date: 30.07.2016 10:22:05 // Design Name: // Module Name: LINEALIZADOR_NORMALIZADOR // Project Name: // Target Devices: //...
#include <bits/stdc++.h> using namespace std; template <typename TP> inline bool rd(TP& r) { r = 0; char tmp = getchar(); while (tmp < 0 || tmp > 9 ) { if (tmp == EOF) return 0; tmp = getchar(); } while ( 0 <= tmp && tmp <= 9 ) { r = (r << 3) + (r << 1) + tmp - 0 ; ...
#include <bits/stdc++.h> const int mod = 1000000007; using namespace std; int dp[5009][5009]; char s1[5009], s2[5009]; int main() { while (scanf( %s%s , s1, s2) == 2) { memset(dp, 0, sizeof(dp)); int len2 = strlen(s2); for (int i = 1; s1[i - 1]; i++) { for (int j = 1; s2[j - 1]; ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_a // // Generated // by: wig // on: Mon Oct 24 15:17:36 2005 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../verilog.xls // // !!! Do not edit this file! Autogenerated by MIX !!! //...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: pcx_data_px2.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 main() { vector<long long> no; long long int n, m, s = 0, a[100000], l = 1, i; cin >> n >> m; for (i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); for (i = 1; i <= m; i++) { if (a[l] == i) l++; else { s +=...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout<< #x << << x << n ; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) #define...
`default_nettype none module dps_utim64( //System input wire iCLOCK, //Global Clock input wire inRESET, //Timer Clock input wire iTIMER_CLOCK, //Counter input wire iREQ_VALID, output wire oREQ_BUSY, input wire iREQ_RW, input wire [4:0] iREQ_ADDR, input wire [31:0] iREQ_DATA, output wire o...
//----------------------------------------------------------------------------- // // (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> int search(int n, long long int a[n], long long int target) { int i; if (a[0] >= target) { printf( 1 %lld n , target); return 0; } int L = 0, R = n - 1; int M; while ((R - L) > 1) { if ((L + R) % 2 == 0) { M = (L + R) / 2; } else { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long int a, b; cin >> a >> b; long long int sumo = 0, sume = 0; for (int i = 1;; i++) { sumo = i * i; if (sumo > a) { cout << Vladik << endl; break; } sume ...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module tlu_controller #( parameter BASEADDR...
#include <bits/stdc++.h> using namespace std; long long mp[2005]; int main() { memset(mp, 0, sizeof mp); long long key[2001], a[2001], n, k, p, i, j; cin >> n >> k >> p; for (i = 0; i < n; i++) { scanf( %lld , a + i); } for (i = 0; i < k; i++) { scanf( %lld , key + i); } ...
// (c) Copyright 1995-2019 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 ...
// bsg_tag_master // // 8/30/2016 // // Usage: send a stream of 0's to reset master node and/or noop. // Then, send a single <1> followed by a packet: // < id > < data_not_reset > < payload length > < payload > // **************************************************************************** // $...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const long long infl = 1LL << 60; mt19937 rnd(time(0)); inline int myrand(int l, int r) { return rnd() % (r - l + 1) + l; } inline int read() { int x = 0, f = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int mod = 998244353; const int M = 1e6 + 10; const int N = 1e5 + 10; inline long long read() { long long b = 1, sum = 0; char c = getchar(); while (!isdigit(c)) { if (c == - ) b = -1; c = getchar(); } while (isdigit(c)) { sum...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Programmable Interrupt Controller //// //// //// //// This file is part of the OpenR...
/* * 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> int n; struct camel { int x, d; inline bool operator<(const camel& a) const { return x < a.x; } } c[105]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d%d , &c[i].x, &c[i].d); std::sort(c, c + n); for (int i = 0; i < n; i++) for (int j ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read() { T f = 0, x = 0; char c = getchar(); while (!isdigit(c)) f = c == - , c = getchar(); while (isdigit(c)) x = x * 10 + c - 48, c = getchar(); return f ? -x : x; } namespace run { inline char getc() { ...
/* * 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) 2014-2018 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
/** * 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; long long int hell = 9223372036854775807; bool a[40000000]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; t = 1; while (t--) { for (long long int i = 1; i < 4000000; i++) { a[i] =...
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 9; int seg[MAX * 4][2], n, k, a, b, q, ar[MAX]; void upd(int x, int s = 0, int e = n, int id = 0) { if (e - s == 1) { seg[id][0] = min(ar[s], a), seg[id][1] = min(ar[s], b); return; } int mid = s + e >> 1; if (x < mi...
/* * 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: 2016/05/24 22:59:56 // Design Name: // Module Name: delay_line1_behavior_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencie...
/** * 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<pair<int, int> > Div[5 * int(1e5 + 100)]; int a[2 * int(1e5 + 100)]; bool Have[2 * int(1e5 + 100)]; int calc[5 * int(1e5 + 100)]; int root[5 * int(1e5 + 100)]; int val = 1; void Prime(int x) { int u = x; root[x] = 1; for (int i = 2; i <= s...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:50:00 2016 ///////////////////////////////////////////////////////////// module ACA_I_N8_Q5 ( in1, in2, res ); input [7:0] in1; input [7:0]...
#include <bits/stdc++.h> using namespace std; int main() { string S, S1, S2, S11, S21; getline(cin, S); int N = S.length(); int i, j, k; int t = 0, t3 = 0; for (i = 0; i < N; i++) { if (S[i] != S[N - i - 1] and t3 == 0) { t3 = 1; if (S[i + 1] == S[N - i - 1]) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01/04/2016 07:18:18 PM // Design Name: // Module Name: Problem2 // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
/** * 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; string s, dum; int idx = 0; int A[5000]; stack<int> S; int main() { while (cin >> dum) { s += dum; } for (int i = 0; i < s.length(); i++) { dum = ; while (s[i] != > ) { dum += s[i]; i++; } dum += > ; ...
/** * 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; using ll = long long; using vi = vector<int>; using db = double; const int mxn = 300006; const ll mod = 1E9L + 7; int n; ll a[mxn]; ll p[mxn]; int main() { cin >> n; for (int i = 0; i < n; ++i) scanf( %lld , &a[i]); sort(a, a + n); p[0] =...
#include <bits/stdc++.h> using namespace std; const int maxn = 200001; int n; int d[maxn], anc[maxn][18], p[maxn]; array<int, 2> tree[maxn * 4]; int jua(int x, int y) { int dd = d[y] - d[x]; for (int i = 17; i >= 0; i--) { if (dd >= 1 << i) { y = anc[y][i]; dd -= (1 << i); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 9; int n; int fs[maxn]; int pj[maxn]; long long ansji, ansou; void solve() { int i; for (i = 1; i <= n; ++i) fs[i] += fs[i - 1]; for (i = 1; i <= n; ++i) { pj[i] = pj[i - 1] + (fs[i] & 1); } for (i = 1; i <= n; ...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m, k; int a[N]; int b[N]; int main() { cin >> n >> m >> k; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n - 1; ++i) { b[i] = a[i + 1] - a[i] - 1; } sort(b, b + n - 1); int kk = n; lon...
// megafunction wizard: %LPM_FIFO+%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_40x128.v // Megafunction Name(s): // scfifo // ============================================================ // ***********...
/* * 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...
//======================================================= // ECE3400 Fall 2017 // Lab 3: Template top-level module // // Top-level skeleton from Terasic // Modified by Claire Chen for ECE3400 Fall 2017 //======================================================= `define ONE_SEC 25000000 module DE0_NANO( ...
#include <bits/stdc++.h> const double PI = 3.141592653589793238460; using namespace std; vector<int> d; vector<int> l; vector<int> r; vector<int> u; bool isPossibleL(string st) { for (char ch : st) { for (int n : l) if (ch - 0 == n) return false; } return true; } bool isPos...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; int n1, n2, n3; cin >> n1 >> n2 >> n3; vector<int> v[n + 1]; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; v[a].push_back(b); v[b]...
#include <bits/stdc++.h> using namespace std; int main() { string second; int ans = 0, a = 1; cin >> second; int k = second.length() - 1; for (int i = 1; i < second.size(); i++) { ans += (1 << i); } for (int i = 0; i < second.length(); i++) { if (i == k) { if (second[...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 50; const int MOD = 1e9 + 9; int n, k, a, b, c, d, m, L, R, tot = 1; pair<int, int> cities[MAXN]; struct TreeNode { int x, l, r, lson, rson; pair<int, int> v; } tree[MAXN]; int newNode(int &x) { return x = ++tot; } pair<int, ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_jp_sstl_oebscan.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 redistribut...
#include <bits/stdc++.h> using namespace std; double L, R; int n, i; int a[10000]; double jami; long long ans1, ans2, ans; int main() { L = 10.0; R = 1000000000; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= n; i++) { L = max(L, (double)((double)a[i] / i) * 10....
#include <bits/stdc++.h> using namespace std; int main() { double ans, B, H; cin >> ans; double ff = 999999999.9; for (double h = 1; h <= 10; h++) { for (double b = 1; b <= 10; b++) { double sum = h * b / sqrt(4 * h * h + b * b); double d = fabs(ans - sum); if (d < ff) ...
#include <bits/stdc++.h> using namespace std; int t, n, pl; string s; int main() { std::ios::sync_with_stdio(false); cin >> t; for (int qqw = 1; qqw <= t; qqw++) { cin >> n; cin >> s; pl = -1; for (int i = 1; i <= n; i++) if (s[i - 1] == 0 ) pl = i; if (pl > 0)...
#include <bits/stdc++.h> using namespace std; const int maxN = 1000005; int sp[maxN]; void seive() { for (int i = 2; i <= 1000000; ++i) { if (sp[i] != 0) continue; for (int j = i; j <= 1000000; j += i) { if (sp[j] == 0) sp[j] = i; } } } int nxtpow(int x) { int p = 1; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 500; long long dp[N]; long long n; void init() { dp[0] = 1ll; dp[1] = 2ll; for (int i = 2; i < N; i++) { dp[i] = dp[i - 2] + dp[i - 1]; } } int main() { init(); while (cin >> n) { int cur = 0; while...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ /* Debug State Capture Trigger captures the state of 3 x 32-bit words (96 bits total). A clock counter is started. Everytime the 96-bit input bits change an entry is made in the buffer with the previous s...
#include <bits/stdc++.h> using namespace std; bool isValid(string s) { bool valid = true; if (s.length() < 1 || s.length() > 16) return false; for (int i = 0; i < s.length(); i++) { if (s[i] < 48 || (s[i] > 57 && s[i] < 65) || (s[i] > 90 && s[i] < 95) || (s[i] > 95 && s[i] < 97) || s[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 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...
//----------------------------------------------------------------------------- // File : instruction_memory.v // Creation date : 28.11.2017 // Creation time : 12:45:25 // Description : Used to supplant instruction memory in simulations. NOTICE: Ports are described in interfaces.local_memory. // Created by ...
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; int Power(int n, int x) { int mul = n; int res = 1; while (x > 0) { if (x & 1) res = 1ll * res * mul % MOD; mul = 1ll * mul * mul % MOD; x /= 2; } return res; } int main() { ios::sync_with_stdio(...
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T& x) { static char c; static int f; for (c = getchar(), f = 1; c < 0 || c > 9 ; c = getchar()) if (c == - ) f = -f; for (x = 0; c >= 0 && c <= 9 ; c = getchar()) x = x * 10 + (c & 15); x *= f; } tem...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e7 + 10; int n, fac[MAX_N], pri[MAX_N], pri_n, fac_cnt[MAX_N], phi[MAX_N]; long long ans; void init() { scanf( %d , &n); for (int i = 2; i <= n; i++) { if (!fac[i]) { phi[i] = (fac[i] = pri[++pri_n] = i) - 1; fac_cn...
/** * 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; int trn = 1 << (n + 1); trn--; int a[30000]; for (int i = 2; i <= trn; i++) cin >> a[i]; int q = 1 << n; int mx = 0; int leng[30000]; for (int i = q; i <= trn; i++) { leng[i] = 0; int j = ...
`timescale 1ns / 1ps module ALUnitSim(); reg [31:0] a; reg [31:0] b; reg [2:0] op; wire [31:0] result; wire zero; ALUnit alu( .a(a), .b(b), .op(op), .result(result), .zero(zero) ); initial begin a = 0; b = 0; op = 0; ...
module sockit_test ( input CLOCK_50, input [3:0] KEY, output [3:0] LED, output [12:0] hps_memory_mem_a, output [2:0] hps_memory_mem_ba, output hps_memory_mem_ck, output hps_memory_mem_ck_n, output hps_memory_mem_cke, output hps_memory_mem_cs_n, outpu...
`timescale 1ns / 1ps // UART wants the LSB first // RX modified to accept 40 MHz clock and receive at 115200 bps // Note 40e6 / 115200 = and 347.2 / 2 = 173.6 ~= 174 cycles // For 460800 // 40e6 / 460800 = 86.8 and 86.8 / 2 =~= 43 // For 230400 // 40e6 / 230400 = 173.6 and 173.6/2 = 86.8 // Modified for 460800 ...
`timescale 1ns / 1ps /* tab size 4 */ module jt51_test; reg clk; reg rst; // Channel frequency reg [6:0] kc; reg [5:0] kf; // Operator multiplying reg [3:0] mul; // Operator detuning reg [2:0] dt1; reg [1:0] dt2; // phase modulation from LFO reg signed [7:0] pm; reg [2:0] pms; // phase operation wire [ 4:0] keyc...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/05/24 16:07:32 // Design Name: // Module Name: lab1_4_1_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
module testbench( input logic writeRead, input logic newService, input logic multiblock, input logic timeoutenable, input logic reset, input logic[3:0] blockSize, input logic fifo_full, input logic [15:0] timeout , input logic SDclock, input logic clock, input logic [31:0] fromFifo_toPS...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7, N = 2e5 + 5; int par[N], over[N]; int getpar(int u) { if (par[par[u]] == par[u]) return par[u]; return par[u] = getpar(par[u]); } bool unite(int a, int b) { a = getpar(a); b = getpar(b); if (a == b) { if (over[a...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/15/2016 02:04:39 PM // Design Name: // Module Name: LZA // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revisi...
/////////////////////////////////////////////////////////////////////////////// // // Project: Aurora Module Generator version 2.2 // // Date: $Date: 2004/11/08 16:19:25 $ // Tag: $Name: i+H-38+78751 $ // File: $RCSfile: clock_module.ejava,v $ // Rev: $Revision: 1.1.6.2 $ // ...
#include <bits/stdc++.h> using namespace std; int n, k; int d[2005]; vector<int> E[2005]; bool h[2005]; const int INF = 1e9 + 7; void add(int u, int v) { E[u].push_back(v); } void bfs() { queue<int> q; d[0] = 0; q.push(0); while (q.size()) { int t = q.front(); q.pop(); ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int n = s.length(); vector<int> v; for (int i = 0; i < n; i++) if (i == n - 1 || s[i] != s[i + 1]) v.push_back(i); if (s.back() == b ) v.pop_back(); vect...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:58:49 03/30/2016 // Design Name: ALU // Module Name: Y:/TEOCOA/EXPR3_DIGITAL/ALU_TEST.v // Project Name: EXPR3_DIGITAL // Target Device: // Tool vers...
#include <bits/stdc++.h> using namespace std; map<long long, string> dic; int main() { long long n; scanf( %lld , &n); for (long long i = 2; (long long)i * i <= n; i++) { for (long long j = i * i, p = 2; j <= n; j *= i, p++) { string str = to_string(i) + ^ + to_string(p); if (d...
#include <bits/stdc++.h> using namespace std; long long a[100005], ac[100005]; int last[100005]; int main() { int n, m, t, x, v, y, q; string s; while (cin >> n >> m) { for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) { cin >> t; if (t == 1) { ...
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); int d, n; cin >> d >> n; vector<int> days(n); for (int i = 0; i < n; i++) cin >> days[i]; int count = 0; for (int i = 1; i < n; i++) count += d - days[i - 1]; cout << cou...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n; map<int, int> uchs; for (int i = 0; i < n; i++) { int x; cin >> x; if (uchs.find(x) != uchs.end()) { (uchs.at(x))++; } else uchs.insert(pair<int, int>(x, 1)); } cin >> m; ...
#include <bits/stdc++.h> using namespace std; const long long DIM = 2e5 + 7; long long n, used[27][DIM], a[DIM], tests; int in; int main() { in = scanf( %lld , &tests); for (long long test = 1; test <= tests; test++) { in = scanf( %lld , &n); long long result = 0; for (long long i = ...
/* _______________________________________________________________________________ Copyright (c) 2012 TU Dresden, Chair for Embedded Systems (http://www.mr.inf.tu-dresden.de) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the follo...
#include <bits/stdc++.h> using namespace std; long long a[8][8], n, m, u, v, k = INT_MAX; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; cin >> n >> m; for (long long i = 0; i < m; i++) { cin >> u >> v; a[u][v] = 1; a[v][u] = 1; } if (n <= 6) ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5 + 100000; int n, m, len_behind, len_front; struct TREE { int fg; int M11[3]; } T[maxn * 4]; inline int L(int &x) { return x << 1; } inline int R(int &x) { return x << 1 | 1; } void f_maintain(int root, int len) { int a = L(root...
#include <bits/stdc++.h> using namespace std; const int Maxn = 50005; char str[Maxn]; int hs[26]; int main() { scanf( %s , str); int len = strlen(str), cCnt = 0; int xNum = 0, sta = 0; bool ok = false; int i; for (i = 0; i < len; i++) { if (i - sta >= 26 && cCnt + xNum == 26) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Case Western Reserve University // Engineer: Matt McConnell // // Create Date: 20:17:00 09/09/2017 // Project Name: EECS301 Digital Design // Design Name: Lab #4 Project // Module Name: ...
/** * 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 = 1000000000; const long long INF_LL = 1000000000000000000LL; const double pi = 2 * acos(0.0); template <class T> void smin(T& a, T b) { if (a > b) a = b; } template <class T> void smax(T& a, T b) { if (a < b) a = b; } template <c...
#include <bits/stdc++.h> using namespace std; int a[10100], b[1010]; int main() { int n, m, c, ans; scanf( %d%d%d , &n, &m, &c); ans = (n + m + c) / 2; if (n + c >= ans && m + c >= ans) printf( %d n , ans * 2); else printf( %d n , min(n + c, m + c) * 2); }
#include <bits/stdc++.h> using namespace std; int j, i, a, b, c, k, d, e, f[1005], n, mi, ma; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> f[i]; ma = max(f[i], ma); } for (i = 0; i < n - 1; i++) for (j = i + 1; j < n; j++) { c = 0; for (k = i; k <= j; k...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, l, c, d, p, nl, nd, np, min = 0, totl, totp, res; cin >> n >> k >> l >> c >> d >> p >> nl >> np; nd = d * c; totl = (k * l) / nl; totp = p / np; if (totl <= nd && totl <= totp) min = totl; else if (nd <= totl && n...
#include <bits/stdc++.h> using namespace std; vector<int> domain; int domain_index(int x) { int id = lower_bound(domain.begin(), domain.end(), x) - domain.begin(); assert(domain[id] == x); return id; } struct Seg { Seg *lc, *rc; int L, M, R; int sum, val; Seg(int l, int r) : L(l), ...
`timescale 1ns / 1ps module Microcontroller( output [31:0] DATO1, output [31:0] DATO2, output [31:0] RESULTADO, input [31:0] MouseData, input CLK, input MOUSECLICK ); /* First of all, let's talk about wires */ wire [1:0] RegSrc, ImmSrc, ALUControl; /* ControlUnit */ wire PCSrc, RegWrite, MemWrite, M...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// (c) Copyright 1995-2014 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 ...
#include <bits/stdc++.h> using namespace std; int a, b, c; int main() { cin >> a >> b >> c; int i, s = 0; for (i = 1; i <= a - 1; i++) s += i; cout << (c + a - 1) * (b + a - 1) - 2 * s; }