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 law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout << setprecision(10); int row, column; char temp; cin >> row >> column; for (int i = 0; i < int(row - 1); ++i) { for (int j = 0; j ... |
//*****************************************************************************
// (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
/... |
/**
* 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... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_eda_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:29 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
`define WIDTH_P ? // unused for now...
module test_bsg;
// Enable VPD dump file
//
initial
begin
$vcdpluson;
$vcdplusmemon;
end
logic TCK;
localparam debug_lp = 0;
localparam bsg_tag_els_lp = 4;
genvar i;
bsg_nonsynth_clock_gen #(100) cfg_clk_gen (TCK)... |
#include <bits/stdc++.h> using namespace std; char gc() { static char buf[1 << 16], *s, *t; if (s == t) { t = (s = buf) + fread(buf, 1, 1 << 16, stdin); if (s == t) return EOF; } return *s++; } int read() { char c; int w = 1; while ((c = getchar()) > 9 || c < 0 ) ... |
/*
* File: reg_sprs.v
* Project: pippo
* Designer: kiss@pwrsemi
* Mainteiner: kiss@pwrsemi
* Checker:
* Description:
Ò»£¬Ö÷Òª¹¦ÄܺÍÂß¼
a£©ÅжϷÖÖ§Ìõ¼þ£¸ù¾ÝBO£¬CRºÍCTR
BO[4] - CR test control
0: Test CR bit specified by BI field
... |
`timescale 1ns/10ps
module sys_pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'outclk1'
output wire outclk_1,
// interface 'outclk2'
output wire outclk_2,
// interface 'locked'
output wire locked
);
a... |
#include <bits/stdc++.h> using namespace std; long long pwr(long long a, long long b, long long mod) { a %= mod; if (a < 0) a += mod; long long ans = 1; while (b) { if (b & 1) ans = (ans * a) % mod; a = (a * a) % mod; b /= 2; } return ans; } long long pwr(long long a, l... |
#include <bits/stdc++.h> using namespace std; int a[200005], ans1 = 1, ans2 = 0; int main() { int n, b, b1; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); } sort(a + 1, a + 1 + n); b1 = 0; for (int i = 2; i <= n; ++i) { b = a[i] - a[i - 1]; if (b ... |
#include <bits/stdc++.h> using namespace std; int main() { int num; scanf( %d , &num); printf( %d , num + 1); } |
#include <bits/stdc++.h> const double pi = 3.1415926535897932384626433832795; int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } using namespace std; void ifd() {} void tme() {} int n, k, h; vector<pair<int, pair<int, int> > > l; vector<int> answer; bool can(double time) {... |
#include <bits/stdc++.h> int main() { long n; scanf( %ld n , &n); std::vector<long> array(n, 0); for (int p = 0; p < n; p++) { scanf( %ld , &array[p]); } bool down = 0, possible = 1; long moves(0); for (int p = 1; p < n; p++) { if (array[p - 1] <= array[p]) { conti... |
`include "elink_regmap.vh"
module ecfg_if (/*AUTOARG*/
// Outputs
mi_mmu_en, mi_dma_en, mi_cfg_en, mi_we, mi_addr, mi_din,
access_out, packet_out,
// Inputs
clk, nreset, access_in, packet_in, mi_dout0, mi_dout1, mi_dout2,
mi_dout3, wait_in
);
parameter RX = 0; //0,1
parameter PW ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21.08.2013 15:05:03
// Design Name:
// Module Name: vc709_10g_interface
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
... |
#include <bits/stdc++.h> using namespace std; inline int read() { char ch = getchar(); int x = 0, f = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while ( 0 <= ch && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f;... |
#include <bits/stdc++.h> using namespace std; const int Max = 1e5 + 5; struct node { int x, y; } Node1[Max], Node2[Max]; int hash1[Max], hash2[Max]; bool cmp(const node a, const node b) { if (a.y == b.y) return a.x < b.x; return a.y < b.y; } int main() { int n, m; while (scanf( %d%d ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, ans, st, ed; cin >> n; string s; cin >> s; st = 1, ed = 1; for (i = 1; i < n; i++) { if (s[i] == s[i - 1]) st++; else break; } for (i = n - 2; i >= 0; i--) { if (s[i] == s... |
`timescale 1ns / 1ps
module jt12_op_tb;
reg [9:0] pg_phase;
reg [9:0] eg_atten;
reg [2:0] voice_fb;
reg op_fb_enable;
reg [5:0] op_algorithm_ctl;
reg test_214;
wire signed [13:0] op_result;
reg clk, rst;
reg signed [13:0] op0;
integer count;
reg [2:0] count6;
reg [1:0] op_count;
initial begin
$dumpfile(... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> vc; vc.clear(); for (int i = 1; i <= sqrt(n); i++) { if (n / i != i) vc.push_back(n / i); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 100; const long long inf = (1LL << 30 - 1); pair<int, int> A[maxn]; int fa[maxn], X[maxn], Y[maxn], Hx[maxn], Hy[maxn], ans[maxn]; int FindSet(int x) { return fa[x] == x ? x : fa[x] = FindSet(fa[x]); } void UnionSet(int u, int v) { u... |
#include <bits/stdc++.h> using namespace std; bool win(long long a, long long b) { if (a < b) swap(a, b); if (!b) return (false); if (!win(b, a % b)) return (true); long long p = a / b; return (p % (b + 1) % 2 == 0); } int main() { int T; scanf( %d , &T); while (T--) { long... |
#include <bits/stdc++.h> using namespace std; long long int getLength(long long int x) { long long int c = 0; while (x > 0) { c++; x /= 10; } return c; } int main() { long long int n, k, i, j; cin >> n >> k; long long int a[n], lengths[n]; for (i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int MOD2 = 1e9 + 9; const int PR = 727; const int INF = INT_MAX; const long long LINF = LLONG_MAX; const int N = 1e5 + 20; vector<int> G[N], p; int n, m, k, f[N], tmp; bool visited[N]; int main() { ios::sync_with_stdi... |
/**
* 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... |
// patterngenerator.v
`timescale 1ns / 1ps
module patterngenerator
(
// avalon clock interface
input csi_clock_clk,
input csi_clock_reset,
// avalon mm slave: status/control
input avs_ctrl_address,
input avs_ctrl_read,
output [31:0]avs_ctrl_readdata,
input avs_ctrl_write,
input [31:0... |
#include <bits/stdc++.h> using namespace std; long long rdtsc() { long long tmp; asm( rdtsc : =A (tmp)); return tmp; } inline int myrand() { return abs((rand() << 15) ^ rand()); } inline int rnd(int x) { return myrand() % x; } const int INF = (int)1.01e9; const long double EPS = 1e-9; void... |
/*
* PicoSoC - A simple example SoC using PicoRV32
*
* Copyright (C) 2017 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... |
#include <bits/stdc++.h> using namespace std; int dp[100][100]; struct point { public: long long x, y; point(long long a, long long b) { x = a; y = b; } point() {} void setPoint(long long a, long long b) { x = a; y = b; } double dist(point p) { return sqrt(po... |
/**
* 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, k, a[100005]; bool pos(int len) { set<pair<int, int> > ms; for (int i = 1; i <= n; i++) { ms.insert(make_pair(a[i], i)); if (i >= len) { auto it = ms.begin(); int mn = (*it).first; it = ms.end(); it--; ... |
/**
* 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() { long long int c, d, x, y, a, b; cin >> a >> b >> x >> y >> c >> d; if (c == 0 and d == 0) { if ((a == x and b == y) or (a == -x and b == -y) or (a == y and b == -x) or (a == -y and b == x)) cout << YES << endl; el... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; double ed(double x1, double y1, double x2, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); double ax, ay, bx, by, tx, ty; int n; cin ... |
// part of NeoGS project (c) 2007-2008 NedoPC
//
// SPI mode 0 8-bit master module
//
// short diagram for speed=0 (Fclk/Fspi=2, no rdy shown)
//
// clock: ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ (positive edges)
// counter: |00|00|10|11|12|13|14|15|16|17|18|19|1A|1B|1C|1D|1E|1F|00|00|... |
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; unsigned long long min(unsigned long long x, unsigned long long y) { if (x < y) return x; return y; } unsigned long long max(unsigned long long x, unsign... |
#include <bits/stdc++.h> using namespace std; int X, Y, Z, N, M, K; int L[3], R[3]; int OK[101010][3], NG[101010][3], Q[101010][3]; int ret[101010]; vector<pair<int, int>> query[8]; void solve() { int i, j, k, l, r, x, y; string s; scanf( %d%d%d%d%d%d , &X, &Y, &Z, &N, &M, &K); R[0] = R[1]... |
#include <bits/stdc++.h> using namespace std; vector<int> houses, shops; int lasthouse = -1, lastshop = -1; bool check(int k, int t, string s) { int l = s.length(), min_index = -1, ans = 0, ct = 0; int ans2 = t + 1; if (lasthouse > lastshop) { if (lastshop == -1) { if (k < houses[lasth... |
#include <bits/stdc++.h> using namespace std; int main() { int i = 0; string s; cin >> s; if (s[0] >= a && s[0] <= z ) s[0] = char(s[0] - 32); cout << s << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; const int order[10][10] = { {99, 98, 97, 96, 95, 94, 93, 92, 91, 90}, {80, 81, 82, 83, 84, 85, 86, 87, 88, 89}, {79, 78, 77, 76, 75, 74, 73, 72, 71, 70}, {60, 61, 62, 63, 64, 65, 66, 67, 68, 69}, {59, 58, 57, 56, 55, 54, 53, 52, 51, 50}, ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3fffffff; const long long _INF = 0x7ffffffffffffffll; const double EPS = 1e-9; const double PI = acos(-1.0); template <class T, class INT> inline T pow(T x, INT y) { T res(1); for (T tt(x); y; y /= 2) { if (y & 1) res *= tt; ... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, 1, -1, -1, -1, 1, 1}; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; char ch[] = { N , S , E , W }; template <class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); } template <class T> inline T bitoff(T n, T pos) { return n ... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
/**
* Testbench: timer
*
* Created:
* Sun Jun 2 18:47:52 EDT 2013
*
* Author:
* Berin Martini ()
*/
`timescale 1ns/10ps
`define TB_VERBOSE
//`define VERBOSE
//`define DEBUG_CONVOLVER
`include "timer.v"
module timer_tb;
/**
* Clock and control functions
*/
// Generate a clk
reg cl... |
#include <bits/stdc++.h> using namespace std; inline long long ma(long long a, long long b) { return a > b ? a : b; } inline long long mi(long long a, long long b) { return a > b ? b : a; } template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << : << arg1 << endl; } temp... |
#include <bits/stdc++.h> using namespace std; const int N = 202; const int C = 6000; int dp[N][C]; int n, k; int a[N][2]; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { long long x; scanf( %lld , &x); while (x % 5 == 0) { a[i][0]++; x /= 5; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:42:46 03/17/2015
// Design Name:
// Module Name: reg32
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
// File: Down_CounterTBV.v
// Generated by MyHDL 0.10
// Date: Tue Aug 14 06:51:23 2018
`timescale 1ns/10ps
module Down_CounterTBV (
);
// myHDL -> Verilog Testbench for `Down_Counter` module
reg clk = 0;
reg rst = 0;
reg Trig = 0;
wire [4:0] count;
reg [4:0] Down_Counter0_0_count_i = 17;
always @(rst, clk, Tr... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int inf = 0x3f3f3f3f; const long long INF = 1e18; template <typename T> void read(T &x) { x = 0; int s = 1, c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) s = -1; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e5 + 10, md = 1e9 + 7; vector<long long> child[MAXN]; long long dp[2][MAXN], dp1[2][MAXN], dp2[2][2][MAXN]; void dfs(long long v) { long long s = child[v].size(); for (long long i = 0; i < s; ++i) { long long now = child[v][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... |
#include <bits/stdc++.h> using namespace std; using LL = long long; const double PI = 3.14159265358979323846; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; void solve() { int n; cin >> n; vector<int> bit(64); LL sum = 0, ans = 0; for (int i = 0; i < int(n); ++i) { LL num; ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); while (c != - && c < 48) c = getchar(); if (c == - ) f = -1, c = getchar(); while (c > 47) x = x * 10 + (c ^ 48), c = getchar(); return f * x; } const int maxn = 3e3 + 7; const in... |
#include <bits/stdc++.h> using namespace std; long long fac[1000001]; int main() { long long n, ans = 0, c = 0, mx = 0, tmp, tmp2, lg; cin >> n; for (long long i = 2; i < n; i++) { tmp = n / i; tmp = tmp * (tmp + 1) / 2 - 1; ans += (tmp * 4); } cout << ans << n ; 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; bool debug; const int inf = 1e9 + 5; const int nax = 3005; vector<int> w[nax]; int d[nax][nax]; int main(int argc, char *argv[]) { debug = argc > 1; int n, m; scanf( %d%d , &n, &m); for (int _ = 0; _ <= (m)-1; ++_) { int a, b; scanf... |
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } template <class t> using v... |
#include <bits/stdc++.h> using namespace std; struct node { int a, v, c, next; node() {} node(int a, int v, int c, int next) : a(a), v(v), c(c), next(next) {} } edge[200010]; struct pp { int v, d1, d2; }; queue<int> q; int n, m, tot; int dis[100010], d[100010], pre[100010], ans[100010], ... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; int N, M; vector<vector<int> > G; vector<long long> cnt; vector<long long> dp; int main(int argc, char const* argv[]) { cin >> N >> M; for (int i = 0; i < N; i++) { G.push_back(vector<int>()); cnt.push_back(0); dp.push_back(1); } ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, c = 0; cin >> n; int arr[n]; set<int> s; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); for (int i = 1; i < n; i++) { if (arr[i] == arr[i - 1]) { c++; arr[i]++; } else if (arr[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... |
#include <bits/stdc++.h> using namespace std; int dp[101][3] = {}; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 1, a; i <= n; ++i) { cin >> a; dp[i][0] = max(dp[i - 1][0], max(dp[i - 1][1], dp[i - 1][2])); if (a & 1) dp[i][1] = max(dp[i - 1]... |
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 77, Mod = 1000000007; struct SegmentTree { int nn; vector<int> LC, RC, S, lz; int cur = 0; inline void __init() { AddNode(); } inline void AddNode() { ++cur; LC.push_back(-1); RC.push_back(-1); S.push_... |
//************************************
// Designed by: Xiaoyu Sun
// Last updated: 15/11/9
//************************************
module reducer(clk, rst, write_in, pair_in, result);
parameter data_size = 32;
parameter word_length = 128;
parameter word_num = 64;
// FSM parameters
parameter START = 4'b... |
#include <bits/stdc++.h> int main() { int n; int a[105]; scanf( %d , &n); int B, C; B = 0; C = 0; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); if (a[i] < 0) C += a[i]; else B += a[i]; } printf( %d n , B - C); } |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> times; int n, k; cin >> n >> k; for (int i = 0; i < n; ++i) { int x; cin >> x; times.push_back(x); } int ans = 0; for (int i = 1; i < n; ++i) { if (times[i] + times[i - 1] < k) { ans +=... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; void solve() { int n; cin >> n; string s; cin >> s; vector<vector<int> > v(26); for (int i = 0; i < n; i++) { char a = s[i]; char k = a; k++; for (char j = k; j <= z ; j++) { int x = j -... |
#include <bits/stdc++.h> using namespace std; int main() { int i, n; string s; cin >> s; vector<int> freq(27, 0); for (i = 0; i < s.length(); ++i) { if (s[i] == B ) freq[26]++; else if (s[i] >= a && s[i] <= z ) freq[s[i] - a ]++; } cout << (min(freq[26], ... |
#include <bits/stdc++.h> using namespace std; int n; string ans, word; vector<int> get_pi(string s) { int j = 0, k = -1; vector<int> q; q.clear(); q.push_back(-1); while (j < s.size()) { if (k == -1 || s[j] == s[k]) { q.push_back(++k); ++j; } else { k = q[... |
/****************************************************************************
MUL/DIV unit
Operation table
op sign dir
4 1 0 x | MULTU
6 1 1 x | MULT
0 0 0 0 | ShiftLeft
1 0 0 1 | ShiftRightLogic
3 0 1 1 | ShiftRightArith
********************... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu May 25 21:06:44 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int a[1000000], ans[1000000]; int n, k, p, x, y, sum = 0; int main() { cin >> n >> k >> p >> x >> y; for (int i = 1; i <= k; i++) { cin >> a[i]; sum += a[i]; } if (sum + n - k > x) { cout << -1; return 0; } for (int i ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long maxn = 2e5 + 5; struct range { long long a, b, c, id; range(long long A, long long B, long long C, long long ID) { a = A; b = B; c = C; id = ID; } }; bool compare(const range &i, ... |
//#############################################################################
//# Purpose: MIO Receive Datapath #
//#############################################################################
//# Author: Andreas Olofsson #
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:42:46 09/09/2015
// Design Name:
// Module Name: buffer_hdl_core
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
//... |
`include "reg_define.v"
module AD9361REG
(
clk,
rst,
en,
wen,
din,
dout,
addr,
ad9361_rstb,
ad9361_en,
ad9361_tx_rx,
ad9361_en_agc,
rf_ctrl_in,
pa_en,
rf_sw
);
parameter BASE = `AD9361REG_BASE;
input clk,rst,en,wen;
input [31:0]din;
input [17:0]addr;
... |
#include <bits/stdc++.h> const long long MOD = 1e9 + 7; using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n; cin >> n; while (n--) { long long ci, sum; cin >> ci >> sum; long long n = sum / ci; long long... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1000006, maxm = 1005; const long long mod = 1000000007; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long powermod(long long a, long long b) { a = a; long long ans = 1; while (b) { if ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:06:52 06/28/2009
// Design Name:
// Module Name: dcm
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// R... |
module debounceSM(
//Inputs
signal_in, rst_n, clk,
//Outputs
signal_out
);
//Inputs
input wire signal_in, rst_n, clk;
//Outputs
output reg signal_out;
localparam target_count = 4'h4;
localparam state_low = 2'b00;
localparam state_posedge = 2'b01;
localparam state_negedge = 2'b10;
localparam stat... |
/*
* 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: 18:38:16 02/21/2015
// Design Name:
// Module Name: mfmDecoder
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 100050; const int M = 10050; long long mn[M], h; int ord[M], tmp[M], que[M], k, n, m; bool was[M]; long long a[N]; int c[N]; stack<int> stk[M]; struct cmp { bool operator()(int i, int j) { return c[i] > c[j] || (c[i] == c[j] && i ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 24.02.2016 19:15:37
// Design Name:
// Module Name: ARINC429_testbench
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
/... |
/**
* 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; int a, b, c; vector<pair<int, int> > v[200005], e[200005]; int p[200005]; int fin(int x) { if (p[x] != x) p[x] = fin(p[x]); return p[x]; } void onion(int x, int y) { if (fin(x) == fin(y)) return; p[fin(y)] = fin(x); } priority_q... |
#include <bits/stdc++.h> using namespace std; int main() { string s, out; cin >> s; for (int i = 0; s[i] != 0 ; i++) { s[i] = tolower(s[i]); if (s[i] == o || s[i] == u || s[i] == i || s[i] == e || s[i] == a || s[i] == y ) ; else { out += . ; ... |
#include <bits/stdc++.h> using namespace std; int p[1000001]; int main() { int n, ind = 0, w, input; cin >> n; for (int i = 0; i < n; i++) { cin >> input; p[input]++; if (ind < p[input]) { ind = p[input]; w = input; } } cout << w << endl; } |
#include <bits/stdc++.h> using namespace std; char ans[100010 * 100]; char s[100010 * 10]; int f[100010 * 100]; int getf(int k) { return k == f[k] ? k : f[k] = getf(f[k]); } int main() { int n, k, LEN = 0, id; cin >> n; for (int i = 0; i < 100010 * 100; i++) f[i] = i; for (int i = 0; i < n; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << n * 2 - n / 2; return 0; } |
// ----------------------------------------------------------------------
// 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:... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 50; signed main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; i++) cin >> a[i]; long long ans = 0; sort(a.begin(), a.end());... |
#include <bits/stdc++.h> using namespace std; template <typename... Ts> void do_nothing(Ts &&...vals) {} constexpr long long MOD = 1000000007; constexpr int INF = 0x7f7f7f7f; constexpr double EPS = 1e-8; long long fastPow(long long num, long long exp, long long modNum) { if (exp == 0) return 1; if... |
//cpu_tb.v
//This is a testbench for the CPU module. AAAAUGH!
module cpu_tb();
reg clk;
wire [31:0] addr;
wire [15:0] memOut;
wire memWrite;
wire memReady;
wire halted;
wire [15:0] memDat;
//Make a small, 16 word memory to play with.
reg [15:0] memoryArray[511:0];
reg [3:0] memSel;
//Allow for addresses to be wrap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.