text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; using ii = pair<int, int>; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc; cin >> tc; while (tc--) { int n, mx = 0, mn; cin >> n; vector<int> v(n); for (int &vi : v) { cin >> vi; mx... |
`timescale 1ns/1ns
module ddr2_interface2um(
fpga_resetn, //system reset,active low
sysclk_100m, //system clk=100MHz LVCOMS
ddr2_ck, //DDR2 System Clock Pos
ddr2_ck_n, //DDR2 System Clock Neg
//Address
ddr2_addr, //only addresses (12:0) are currently used for 512Mb(32Mb*16) DDR2 SDRAM... |
/**
* 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; template <class T, class V> ostream &operator<<(ostream &s, pair<T, V> a) { s << a.first << << a.second; return s; } struct NTT { long long int MD, M = 1, R; vector<int> r; vector<long long int> w[2]; long long int bigmod(long long int ... |
/**
* 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, q; int arr[110][110], r[10010], c[10010], v[10010], t[10010]; int main() { scanf( %d , &n), scanf( %d , &m), scanf( %d , &q); for (int z = 0; z < q; ++z) { scanf( %d , &t[z]); if (t[z] == 1) scanf( %d , &r[z]); if (t[z] == 2) scan... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
#include <bits/stdc++.h> using namespace std; template <typename T> string toString(T x) { if (x == 0) return 0 ; bool negative = x < 0; string res; while (x) { res.push_back( 0 + x % 10); x /= 10; } if (negative) res.push_back( - ); reverse(res.begin(), res.end()); r... |
// $Id: c_prio_enc.v 1734 2009-12-15 03:27:19Z dub $
/*
Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of sou... |
#include <bits/stdc++.h> using namespace std; const int N = 1e4 + 5; int n, a[N]; int main() { ios ::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen( main.in , r )) freopen( main.in , r , stdin); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; int cnt = 0; for (int i... |
module main;
string foo;
int error_count;
task check_char(input int idx, input [7:0] val);
if (foo[idx] !== val) begin
$display("FAILED: foo[%0d]==%02h, expecting %02h",
idx, foo[idx], val);
error_count = error_count+1;
end
endtask // check_char
initial begin
// These ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, l[10], r[10], t = 1; double ans = 0, o = 1; cin >> n; for (int i = 0; i < n; i++) { t *= 2; cin >> l[i] >> r[i]; o *= r[i] - l[i] + 1; } if (n == 1) { cout << setprecision(10) << fixed << (r[0] + l[0]) ... |
#include <bits/stdc++.h> using namespace std; template <typename T> constexpr string_view gtype() { string_view s = __PRETTY_FUNCTION__; return string_view(s.data() + 45, s.find( ; , 45) - 45); } const int MAXN = 10000; int arr[MAXN]; int best[MAXN]; int cur[MAXN]; int n; const long long MOD... |
//----------------------------------------------------------------------
// Title : Vector Configuration Testbench
// Project : Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper
// File : configuration_tb.v
// Version : 1.5
//-----------------------------------------------------------------------------
/... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> len(n); vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; len[i] = s[i].length(); } const int all = n - 1 + accumulate(len.begin(), len.end(), 0); vector<vector<bool>> eq... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; pair<int, int> mmx[3]; for (int i = 0; i < 3; i++) cin >> mmx[i].first >> mmx[i].second; int a, b, c; a = min(n - mmx[1].first - mmx[2].first, mmx[0].second); b = min(n - a - mmx[2].first, mmx[1].second); c =... |
#include <bits/stdc++.h> using namespace std; int dx8[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, dx4[4] = {-1, 0, 1, 0}; int dy8[8] = {0, -1, -1, -1, 0, 1, 1, 1}, dy4[4] = {0, -1, 0, 1}; inline void open(string name) { freopen((name + .in ).c_str(), r , stdin); freopen((name + .out ).c_str(), w , stdout); ... |
#include <bits/stdc++.h> using namespace std; int n, i, tmp, res, a[10000]; bool kt; int main() { scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]); kt = true; for (i = 3; i <= n; i++) if (a[i] - a[i - 1] != a[i - 1] - a[i - 2]) kt = false; if (kt == false) { printf( %... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2017 by Josh Redford.
interface my_if;
logic valid;
logic [7:0] data ;
modport slave_mp (
input valid,
input data
... |
#include <bits/stdc++.h> const int oo = 2139063143; const int N = 101000; const int P = 1000000007; using namespace std; inline void sc(int &x) { x = 0; static int p; p = 1; static char c; c = getchar(); while (!isdigit(c)) { if (c == - ) p = -1; c = getchar(); } w... |
#include <bits/stdc++.h> using namespace std; int main() { string s, spr; vector<string> valer; cin >> s; char h; int k = (int)s.size(); valer.push_back(s); for (int i = 1; i < k; i++) { h = s[k - 1]; for (int j = k - 1; j > 0; j--) { s[j] = s[j - 1]; } s[... |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[200]; int n, x; vector<pair<int, int> > res; int main() { int sum = 0; cin >> n; cin >> a[0].first; a[0].second = 0; sum += a[0].first; for (int i = 1; i < n; i++) { cin >> a[i].first; a[i].second = i; sum... |
#include <bits/stdc++.h> using namespace std; char st[100000]; int n, t, a[26], minn, maxx; int main() { scanf( %d%d , &n, &t); scanf( %s , st); minn = 25; maxx = 0; for (int i = 0; i < n; i++) { if (st[i] - 97 < minn) minn = st[i] - 97; if (st[i] - 97 > maxx) maxx = st[i] - 97; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 0) cout << 1; else { n %= 4; if (n == 0) n = 4; n = pow(8, n); cout << n % 10; } } |
//*****************************************************************************
// (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 prope... |
#include <bits/stdc++.h> using namespace std; int n, m, gxx; pair<int, int> a[411111]; int p[411111]; int Gxx[411111], bb[411111]; int degree[411111]; int h, t; void make_ans(int x, int y, int tot) { int now_x = degree[x] - 1 - tot; int need_x = max(h - now_x, 0); int now_y = degree[y] - 1 -... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; long long int sum[N << 2][11], sum2[11], a[N]; int lazy[N << 2][11], vis[11]; void pushdown(int rt) { for (int i = 0; i < 10; i++) vis[i] = lazy[rt << 1][i], sum2[i] = sum[rt << 1][i]; for (int i = 0; i < 10; i++) if (laz... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: GDA_St_N8_M8_P5
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
/* Description of an 8-bit data 8-bit address rom. */
module rom(en,rwb,addr,data);
input[7:0] addr;
output reg [7:0] data;
always @ (*)
begin
case(addr)
0: data <= 0;
1: data <= 1;
2: data <= 2;
3: data <= 3;
4: data <= 4;
... |
// --------------------------------------------------------------------
// Copyright (c) 2007 by Terasic Technologies Inc.
// --------------------------------------------------------------------
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for all Ter... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long i, j, k; int n; cin >> n; vector<int> arr(n); int f, l; f = 1; l = n; int sz = 0; while (sz < n) { if (sz % 2 == 0) { arr[sz] = f; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> void pr(vector<T> &v) { for (int i = 0; i < (int)(v).size(); i++) cout << v[i] << ; cout << n ; ; } template <typename T> void pr(vector<vector<T>> &v) { for (int i = 0; i < (int)(v).size(); i++) { pr(v[i]); }... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: sfifo_144x128.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// =========================================... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; const int dx[4] = {1, -1, 0, 0}; const int dy[4] = {0, 0, 1, -1}; int read() { int s = 0; char c = getchar(), lc = + ; while (c < 0 || 9 < c) lc = c, c = getchar(); while ( 0 <= c && c <= 9 ) s = s * 10 + c - 0 , c = ... |
#include <bits/stdc++.h> using namespace std; int n, a[105], b[105], c[105], tot, ans; char s[105]; int main() { scanf( %d , &n); scanf( %s , s + 1); for (int i = 1; i <= n; i++) { scanf( %d%d , &a[i], &b[i]); c[i] = s[i] - 0 ; if (c[i] == 1) tot++; } ans = tot; for (i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; int count = 1; a[0] = 0; a[1] = 2; for (int i = 2; i < n; i++) { count++; a[i] = a[i - 1] + count; if (a[i] > n) { int rem = a[i] - n; a[i] = a[0] + rem; } } ... |
module aaa (/*AUTOARG*/
// Outputs
y1, y0,
// Inputs
y3, y2
);
/*AUTOOUTPUT*/
// Beginning of automatic outputs (from unused autoinst outputs)
output y0; // From bbb of bbb.v
output y1; // From bbb of bbb.v
// End of automatics
/*AUTOINPU... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5, INF = -1e9; long long down[N], mx[N], up[N], dp[N], sum[N]; unordered_map<long long, vector<long long>> mp[N]; long long n, m, pre[N], suf[N], ans[N]; vector<pair<long long, long long>> adj[N]; bool mark[N]; void dfs_down(long lo... |
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 30; vector<int> w, cn, c, d, p; vector<bool> used; int find(int x) { return (p[x] == x ? x : p[x] = find(p[x])); } void un(int x, int y) { x = find(x); y = find(y); if (rand() & 1) p[x] = y; else p[y] = x; } i... |
/*
Copyright (c) 2016 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, distribute,... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int M = 1e9 + 7; int n; double v, v2, a[N], b[N]; double x, y; int id = 1; int main() { ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> v >> v2; for (int i = 0; i < n; ++i) { cin >> b[i]; ... |
#include <bits/stdc++.h> const int mo = 1000000007, x[9][9] = {{0, 0, 0, 0, 1, 1, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 1, 1}, {0, 0, 0, 0, 1, 1, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 1, 1, 0, 0, 0, 0, 1}, ... |
module spwm
#(parameter cwidth=32,
parameter kwidth=10)
(input clk,
input rstn,
input [cwidth-1:0] d_init,
input [cwidth-1:0] d_delta,
input [cwidth-1:0] d_pwm,
input [kwidth-1:0] k_max,
input updown,
input d0_level,
input clr_it,
output reg io,
output it);
... |
/*
* File: pippo_div64x32.v
* Project: pippo
* Designer:
* Mainteiner:
* Checker:
* Description: implmentation of 32/32 divider
Currently, the implementation signed-extend the 32-bit divident to 64 bit, then divide
using non-restoring algorithm: Detailed algorithm see [Comp... |
// $Id: aeMB_bpcu.v,v 1.4 2007/11/14 22:14:34 sybreon Exp $
//
// AEMB BRANCH PROGRAMME COUNTER UNIT
//
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <>
//
// This file is part of AEMB.
//
// AEMB is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int inf = 2e9 + 5; const int N = 1e5; int cost[26]; map<long long, long long> m[26]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); for (int i = 0; i < 26; i++) cin >> cost[i]; string s; cin >> s;... |
#include <bits/stdc++.h> using namespace std; long long n, x, sum; vector<long long> my, temp; int main() { ios::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> n; for (long long i = 0; i < n; i++) { cin >> x; my.push_back(x); temp.push_back(x); } for (long long i... |
`include "assert.vh"
module genrom_tb();
parameter AW = 4;
parameter DW = 8;
parameter EXTRA = 4;
reg clk = 0;
logic[ AW:0] addr;
logic[ EXTRA-1:0] extra;
logic[ AW:0] lower_bound=0;
logic[ AW:0] upper_bound=9;
wire [DW*2**EXTRA-1:0] data... |
#include <bits/stdc++.h> using namespace std; vector<int> v1; int status[(100000007 / 32) + 10]; bool check1(int n, int pos) { return (bool)(n & (1 << pos)); } int set1(int n, int pos) { return n = n | (1 << pos); } void sieve() { int i, j, k; k = int(sqrt(100000007)); for (i = 3; i <= k; i += 2... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; struct Sync_stdio { Sync_stdio() { cin.tie(NULL); ios_base::sync_with_stdio(false); } } _sync_stdio; struct FAIL { FAIL() { cout << CHANGE!!! << n ; } }; string go(int iter, long long... |
#include <bits/stdc++.h> const int N = 5e4 + 5; struct Point { int x, y, z, id; void input() { scanf( %d%d%d , &x, &y, &z); } } a[N]; int main() { std::map<std::pair<int, int>, std::vector<Point> > f; std::map<int, std::vector<Point> > g; std::vector<Point> h; int n; scanf( %d , &n);... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } signed main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long maxa... |
/**
* 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 = 1e5 + 5; int n, m, ROOT, head; bool vis[MAXN]; int depth[MAXN], deg[MAXN]; vector<int> adj[MAXN]; vector<int> c; stack<int> stk; pair<bool, vector<int> > independentSet() { set<pair<int, int> > s; vector<int> v; for (auto i = 0... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.3 (lin64) Build Wed Oct 4 19:58:07 MDT 2017
// Date : Tue Oct 17 18:55:12 2017
// Host : TacitMonolith running 64-bit Ubuntu 16.04.3... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; long long mpow(long long x, long long y) { if (y == 0) return 1; if (y % 2) return x * mpow(x, y - 1) % MOD; long long h = mpow(x, y / 2); return h * h % MOD; } long long arr[111111]; int main() { int k; sca... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; char A[MAXN]; char B[MAXN]; int n; void open() { freopen( B.in , r , stdin); freopen( B.out , w , stdout); } void close() { fclose(stdin); fclose(stdout); } void init() { scanf( %s , A + 1); scanf( %s , ... |
#include <bits/stdc++.h> using namespace std; const int S = 100009; vector<int> in[S]; vector<int> out[S]; bool viz[S]; int moa[S]; vector<int> topol; vector<int> rang[S]; void dfs(int a) { if (viz[a]) return; viz[a] = 1; for (auto u : out[a]) dfs(u); topol.push_back(a); } void sfd... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, m; cin >> n >> m; ; int a[n + 1]; memset(a, 0, sizeof(a)); for (long long i = 0; i < m; i++) { long long t; cin >> t; ; for (long long j = t; j < n + 1; j++) { if (a[j] == 0) a[j] = t; ... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_no_transition (clock, reset, enable, test_expr, start_state, next_state, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width ... |
#include <bits/stdc++.h> using namespace std; int N, K, A, B, Q, x, y, t, ans; int data[200010]; class segleaf { public: int s[2]; } seg[2000010]; void change(int x, int l, int r, int t, int delta) { if (l == r) { data[t] += delta; seg[x].s[0] = min(data[t], B); seg[x].s[1] = mi... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline istream &operator>>(istream &s, vector<T> &v) { for (T &t : v) { s >> t; } return s; } template <typename T> inline ostream &operator<<(ostream &s, const vector<T> &v) { for (int i = 0; i < int(v.size()); ++i) {... |
#include <bits/stdc++.h> using namespace std; long long a[105], ans, n; int main() { scanf( %lld , &n); for (long long i = 1; i <= n; i++) { scanf( %lld , &a[i]); ans += a[i] * i; } printf( %lld n , ans); return 0; } |
/*
Copyright (c) 2015-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; const int maxn = 100010, mod = 998244353; inline int read() { int x = 0, f = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) f |= ch == - , ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return f ? -x : ... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int cnt[N]; int n, k; int cut[N]; vector<pair<int, int> > arr; struct Sub { bool operator()(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) { if (a.first != b.first) return a.first < b.first; else ... |
#include <bits/stdc++.h> using namespace std; const long double PI = 3.141592653589793238; const double EPS = 1e-6; void solve() { long long r, g, b, w; cin >> r >> g >> b >> w; long long total = r + g + b + w; long long odd = 0; odd = r % 2 + g % 2 + b % 2 + w % 2; long long col = r && ... |
/*
Module: snes_controller
Description: Fetches snes controller buttons
and returns them as an array of 12 stored in buttons.
A FSM is implemented to fetch data,
also taking into account the correct
clock speed by scaling down the clock
slow enough for the controller to read
... |
#include <bits/stdc++.h> using namespace std; int n, ans; void boost() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { boost(); cin >> n; for (int a = 0; a <= 1; a++) { for (int b = 0; b <= 1; b++) { for (int c = 0; c <= 1; c++) { for (in... |
/*
* 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 fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; } int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; } const long long int MAXN = 1e5 + 3; long long int dp[20][2][10][10]; vector<long long int> digits; void conv... |
//*******************************************************************************************************************************************************/
// Module Name: stack
// Module Type: Last in First Out (LIFO) Stack Register
// Author: Shreyas Vinod
// Purpose: Stack for Neptune I v3.0
// Description: A sy... |
// --------------------------------------------------------------------
// Copyright (c) 2008 by Terasic Technologies Inc.
// --------------------------------------------------------------------
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for all Ter... |
#include <bits/stdc++.h> using namespace std; template <typename T> void out(T x) { cout << x << endl; exit(0); } const int maxn = 1e6 + 5; int n, m; int a[maxn]; vector<int> g[maxn]; vector<pair<int, pair<int, int>>> edges; int par[maxn], siz[maxn]; int f(int x) { return par[x] == x ? x :... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, p, q, r; cin >> n >> p >> q >> r; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long dp[n][3]; dp[0][0] = 1ll * p * a[0]; for (int ... |
`timescale 1ns / 1ps
module ADC_interface_AXI_XADC (
//----general--input----
input CLK,
input RST,
// AXI-4 SLAVE Interface
input axi_awvalid,
output axi_awready,
input [32-1:0] axi_awaddr,
input [3-1:0] axi_awprot,
input axi_wvalid,
output axi_wready,
input [32-1:0... |
#include <bits/stdc++.h> using namespace std; int dx[] = {+1, -1, +0, +0}; int dy[] = {+0, +0, +1, -1}; int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1}; int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; int hr[] = {-2, -2, -1, +1, +2, +2, -1, +1}; int hc[] = {+1, -1, +2, +2, -1, +1, -2, -2}; const int MAXN = 1e5... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-8; const int INF = 1E9; const int MAXN = 11111; int n, maxc; int l[MAXN], r[MAXN], b[MAXN]; int _less[MAXN]; int id[MAXN], mx; double ans, dp[11][MAXN], sum[11][MAXN]; double p[11]; int main() { ... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.0
// Ultra-Embedded.com
// Copyright 2011 - 2013
//
// Email:
//
// ... |
/**
* 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> #pragma clang diagnostic push #pragma clang diagnostic ignored -Wunused-const-variable using namespace std; template <typename T> class Modular { public: using Type = typename decay<decltype(T::value)>::type; constexpr Modular() : value() {} template <typename U> ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 100100; const long long oo = 1e18; int N; long long P[MAX], D[MAX]; int L[MAX], R[MAX]; void init_L() { stack<int> S; for (int i = 0; i <= N + 1; ++i) { while (S.size() >= 2) { int x = S.top(); S.pop(); if ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`include "verilated.v"
`define STRINGIFY(x) `"x`"
module t;
integer infile, outfile;
integer count... |
//
// Copyright (c) 1999 Stephen Williams ()
//
// 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; int main() { int n; cin >> n; char board[n][n]; bool even = true; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> board[i][j]; for (int i = 0; i < n; i++) { int c = 0; for (int j = 0; j < n; j++) { if (i -... |
#include <bits/stdc++.h> using namespace std; string gen[100]; string merge(string s1, string s2) { int e = s1.size() - 1; for (int i = 0; i < s2.size(); i++) { if (s1[0] == s2[i]) { int k = s2.size() - i; if (k <= s1.size()) { s1.erase(0, k); return s2 + s1; ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; int count = 0; int min = a; if (b < a) { min = b; } int x = c / min; for (int i = 0; i <= x; i++) { for (int j = 0; j <= x; j++) { if (count != 0) { break; ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 9223372036854775807; const long long MOD = 1000000007; const long double PI = acos(-1); inline long long power(long long a, long long b, long long z = MOD) { long long res = 1; a = (a % z); while (b) { if (b & 1) res = (res ... |
// USED ONLY TO SELECT PL BLOCKED STATUS
// OPTIMISE FOR XY ROUTING
/* autovdoc@
*
* component@ unary_select_pair
* what@ A sort of mux!
* authors@ Robert Mullins
* date@ 5.3.04
* revised@ 5.3.04
* description@
*
* Takes two unary (one-hot) encoded select signals and selects one bit of the input.
*
* Imp... |
//Legal Notice: (C)2016 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... |
/**
* 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... |
/**
* 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... |
// ----------------------------------------------------------------------------------
// -- Company: The Most Awesome Mad Scientist Ever
// -- Engineer: Rongcui Dong
// --
// -- Create Date: 06/29/2017 07:16:10 PM
// -- Design Name:
// -- Module Name: BRAM
// -- Project Name:
// -- Target Devices:
// -- Tool Versions:
... |
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; int flag = 1; int st; char c = s[0]; for (int i = 1; i < n; i++) { if (s[i] == c) contin... |
`timescale 1ns/1ps
`include "../global.v"
module FPU_top_int2fp_tb();
reg clk, reset;
reg [3:0] opCode;
reg [1:0] roundingMode;
reg [31:0] A;
reg [31:0] B;
reg [31:0] ER; //expected result
wire resultReady;
wire [31:0] result;
wire invalidOperation, divisionByZero, overflow, under... |
/////////////////////////////////////////////////////////////
// Created by: Synopsys DC Expert(TM) in wire load mode
// Version : L-2016.03-SP3
// Date : Mon Oct 17 14:34:16 2016
/////////////////////////////////////////////////////////////
module FSM_Add_Subtract ( clk, rst, rst_FSM, beg_FSM, zero_flag_i,
... |
#include <bits/stdc++.h> using namespace std; long long modpow(long long b, long long e, long long mod) { long long ans = 1; for (; e; b = b * b % mod, e /= 2) if (e & 1) ans = ans * b % mod; return ans; } const int N = 5050; int dp[N][N][2], c[N], n; bool vis[N][N][2]; int solve(int x, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.