text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,unroll-loops,no-stack-protector,fast-math,inline ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2 ) using namespace std; using ll = long long; using vvi = vector<vector<int>>; using vi = vector<int>; using vvll = vector<vector<long... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 2013 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 proper... |
#include <bits/stdc++.h> using namespace std; double a[1 << 19]; double ans; int n, r, w; int main() { scanf( %d%d , &n, &r); w = 1 << n; for (register int i = 0; i < w; i++) { scanf( %lf , &a[i]); ans += a[i]; } printf( %.6lf n , ans / w); while (r--) { int pos; ... |
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; x = abs(x); int pos = 0; int i; for (i = 1; pos < x; i++) pos += i; int diff = pos - x; if (diff % 2 == 0) cout << (i - 1) << endl; else { if (i % 2 != 0) cout << i << endl; else... |
/**
* 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... |
module test(
input keyon_now,
input keyoff_now,
input [2:0] state_in,
input [9:0] eg_in,
// envelope configuration
input [4:0] arate, // attack rate
input [4:0] rate1, // decay rate
input [4:0] rate2, // sustain rate
input [3:0] rrate,
input [3:0] sl, // sustain level
// SSG operation
i... |
`timescale 1 ns / 1 ps
module axi_cfg_register #
(
parameter integer CFG_DATA_WIDTH = 1024,
parameter integer AXI_DATA_WIDTH = 32,
parameter integer AXI_ADDR_WIDTH = 32
)
(
// System signals
input wire aclk,
input wire aresetn,
// Configuration bits
out... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_rxcounters.v ////
//// ////
//// This file is part of the E... |
#include <bits/stdc++.h> using namespace std; int main() { double a, b, mn = 1e12; cin >> a >> b; int n; cin >> n; while (n--) { double x, y, v, dis; cin >> x >> y >> v; dis = sqrt((a - x) * (a - x) + (b - y) * (b - y)); dis /= v; mn = min(mn, dis); } cout <... |
#include <bits/stdc++.h> using namespace std; const int N = 100500; int n, m; char s[N]; int dp[N]; void solve() { scanf( %d%d%s , &n, &m, s); long long ans = (m - 1) * n; for (int i = 0; i < n; i++) { if (i - 1 >= 0 && s[i] != s[i - 1]) ans += (m - 1) * i; if (i + 1 < n && s[i] != s... |
module bcd_to_7seg #(parameter COUNT = 1)
(input wire[COUNT*4 - 1:0] bcd, input wire[COUNT - 1:0] dot,
output reg[COUNT*8 - 1:0] out);
genvar i;
generate
for(i = 0; i < COUNT; i = i + 1) begin: gen
always @(bcd[(i + 1) * 4 - 1 : i * 4] or dot[i]) begin
case(bcd[(i +... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; int com(const void* a, const void* b) { return *(int*)a - *(int*)b; } int main(void) { int n, k, i; cin >> n >> k; if (n / 2 > k) cout << -1; else if (n == 1 && k != 0) cout << -1; else { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, res1, res2; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; res1 = a[0] ^ a[1]; vector<int> st; for (int i = 0; i < n; i++) { while (!st.empty() && st.back() < a[i]) st.pop_back(); st.push_... |
#include <bits/stdc++.h> using namespace std; int n, k; vector<bool> is_important; vector<vector<int> > graph; vector<int> used; vector<int> res; bool dfs(int v) { used[v] = 1; bool f_p = is_important[v]; for (int u : graph[v]) { if (used[u] == 0) { f_p = dfs(u) || f_p; } e... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//****************************************************************************************************
//*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved-----------------
//
// -- It to be define --
// -- ... |
#include <bits/stdc++.h> using namespace std; pair<int, int> volc[100000]; int main() { int n, m; scanf( %d , &n); scanf( %d , &m); for (int i = 0; i < m; i++) { scanf( %d , &volc[i].first); scanf( %d , &volc[i].second); } sort(volc, volc + m); int x = 0; vector<pair<in... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int N, M; int A[5002], B[5002]; int D[5002], E[5002], F[5002]; int result; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int getDif(int x) { int resnow = 0; for (int i = 1; i <= M; ++i) ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 4e18; const long long MAX = 1e5; const long long MV = 1e18; const long double PI = 3.14159265358979323846; long long MA = -INF, MI = INF; long long PO(long long x, long long y) { if (y == 0) return 1; ... |
#include <bits/stdc++.h> using ll = int; const ll mod = 1e15 + 7; const ll N = 1e5 + 5; const int base = 400; using ull = unsigned long long; using namespace std; ll n, m, t, k, T, a[N], dp[N], lab[N], u, v, b[N], d[N], tong, cnt, q, fe[N], f[N][20], g[N][20], h[N], P[N][20]; ll ans; vector<ll> ... |
#include <bits/stdc++.h> using namespace std; long long a[1 << 20], b[1 << 20], ans; char s[20][1 << 20]; int bit[1 << 20], now, k, n, m, i, N; void FWT(long long *a, int o) { for (int i = 1; i < N; i <<= 1) for (int j = 0; j < N; j += i << 1) for (int k = 0; k < i; k++) { long lon... |
#include <bits/stdc++.h> using namespace std; long long int fast_expo(long long int x, long long int p) { if (p == 0) return 1; else if (p % 2 == 0) { long long int t = fast_expo(x, p / 2) % 1000000007; return (t * t) % 1000000007; } else return (x * (fast_expo(x, p - 1)) % 10000... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RIT
// Engineer: Cody Cziesler, Nick Desaulniers
//
// Create Date: 11:44:01 04/07/2011
// Design Name: execute
// Module Name: execute
// Project Name: omicron
// Target Devices: ... |
#include <bits/stdc++.h> using namespace std; int main() { int k, l, i = 0, mod = 0; cin >> k; cin >> l; while (l > 1) { mod += l % k; l = l / k; i++; } if (mod > 0) cout << NO ; else cout << YES << endl << i - 1; return 0; } |
#include <bits/stdc++.h> namespace LYD { inline int read() { int x = 0, data = 1; char ch = getchar(); while ((ch > 9 || ch < 0 ) && ch != - ) ch = getchar(); if (ch == - ) { ch = getchar(); data = -1; } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch ... |
#include <bits/stdc++.h> using namespace std; bool DBG = 0; const int dbg = 0; using ii = pair<int, int>; using cd = int64_t; cd gcd(cd a, cd b) { return b ? gcd(b, a % b) : a; } using _LD = long double; struct ld { cd a, b; ld(cd a, cd b = 1) : a(a), b(b) { reduce(); } ld operator-() const ... |
#include <bits/stdc++.h> using namespace std; int Ss[10005], Ee[10005]; int pre[10005 * 200][26]; char A[10005], s[10005], e[10005]; int main() { scanf( %s%s%s , A, s, e); int n = strlen(A); int lens = strlen(s); int lene = strlen(e); int i, j; memset(Ss, 0, sizeof(Ss)); memset(Ee,... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200010; const int mod = 1e9 + 7; inline int cal(int x, int y) { int l = 0, r = 1e9; while (l < r) { int mid = l + r + 1 >> 1; if (3ll * mid + y <= x) l = mid; else r = mid - 1; } if (y > x) return 0;... |
#include <bits/stdc++.h> using namespace std; int l[100005], r[100005]; int main(int argc, char* argv[]) { std::ios::sync_with_stdio(false); int n, k; scanf( %d%d , &n, &k); int sum = 0; for (int i = 0; i < n; i++) { scanf( %d%d , &l[i], &r[i]); sum += r[i] - l[i] + 1; } in... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int a, b; cin >> a >> b; long long int x; x = a % b; if (x == 0) cout << x << endl; else { long long int r = a / b; long long int res ... |
#include <bits/stdc++.h> using namespace std; long long A[200010], sz[200010], v[200010][11]; vector<long long> l[11]; class Timer { private: using clock_t = std::chrono::high_resolution_clock; using second_t = std::chrono::duration<double, std::ratio<1> >; std::chrono::time_point<clock_t> m_beg;... |
#include <bits/stdc++.h> const long long mod = 1e8; using namespace std; bool in(int x, int l, int r) { return l <= x && x <= r; } void solve() { long long l, r; cin >> l >> r; vector<long long> v; long long p = -1; for (int i = 61; i >= 0; i--) { unsigned long long mask = 1ull << 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... |
// ******************************************************************************* //
// ** General Information ** //
// ******************************************************************************* //
// ** Module : firdecim_m4_n12_wrap.v ... |
#include <bits/stdc++.h> using namespace std; int main() { double r, x1, y1, x2, y2; cin >> r >> x1 >> y1 >> x2 >> y2; double distance = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); if (distance == 0) { cout << 0; return 0; } if (distance <= 2 * r) { cout << 1; ... |
#include <bits/stdc++.h> using namespace std; typedef int matrix[130][130]; long long n; vector<int> v[130]; int k, q[30], d, f[30], h[130], len[30], r[30], ans; matrix a, b, t; char c; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } void mul(matrix a, matrix b) { for (int i = 0; i < len[0... |
#include <bits/stdc++.h> using namespace std; const double PI = 2.0 * acos(0.0); const double EPS = 1e-9; const int MOD = 1000000007; const int INF = 1000000000; const long long LINF = 1000000000000000000LL; int main() { int r, h, ret, m, x; scanf( %d %d , &r, &h); r *= 2, h *= 2, ret = h / r ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:05:23 02/09/2017
// Design Name:
// Module Name: Display
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; map<long long, long long> pos, icon; void read() { cin >> n >> m >> k; for (long long i = 1; i <= n; i++) { long long temp; cin >> temp; pos[temp] = i; icon[i] = temp; } } void solve() { long long ans = ... |
#include <bits/stdc++.h> using namespace std; int n; int x[33333]; int C[33333]; int BB[33333]; int seen[33333]; int seena[33333]; int main() { scanf( %d , &n); int cc = 0; for (int i = 0; i < 2 * n; i++) { scanf( %d , &x[i]); C[x[i]]++; BB[x[i]]++; } int ca = 0, cb... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: RAMB16_S4_altera.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========... |
/*
* 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... |
// (c) Copyright 1995-2016 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; char a[1005], b[1005]; int main() { int n, i; scanf( %d , &n); scanf( %s , a + 1); scanf( %s , b + 1); int ans1 = n, ans2 = 0; sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + n); int lab = 1, cnt = 1; while (lab <= n) { if (a[cnt]... |
module I2CSlave(CLCK, SCL, SDA, CNTR1, CNTR2, CNTR3, CNTR4, CMD, TEND);
input CLCK;
input SCL;
inout SDA;
input[15:0] CNTR1;
input[15:0] CNTR2;
input[15:0] CNTR3;
input[15:0] CNTR4;
output[7:0] CMD;
output[1:0] TEND;
//Device's slave address
parameter slaveaddress = 7'b1110010;
//Count of bytes to be ... |
/*
Copyright 2010 David Fritz, Brian Gordon, Wira Mulia
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 3 of the License, or
(at your option) any later version.
... |
`timescale 1ns / 1ps
/*
-- Module Name: Source
-- Description: Emulador de origen de paquetes para la red en-chip. El
modulo se encuentra descrito de manera comportamental.
Este modulo no es sintetizable, su uso se limita a fines
de validacion y pruebas de rendimiento.
-- Dependencies: -- system.vh
... |
module automatic_events3();
reg [1:0] Source;
initial begin
Source[0] = 1'b0;
forever begin
#20 Source[0] = 1'b1;
#20 Source[0] = 1'b0;
end
end
initial begin
Source[1] = 1'b0;
#15;
forever begin
#10 Source[1] = 1'bx;
#10 Source[1] = 1'b1;
#10 Source[1] = 1'bx;
#10 Source[1] = 1'b0... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template <class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> inline bool Max(T &a, T b) { re... |
#include <bits/stdc++.h> using namespace std; long long dp[15][1 << 15]; int n, m, q; struct NodeLCA { int a, b, c; }; vector<pair<int, int> > path; vector<NodeLCA> LCA; void readData() { cin >> n >> m >> q; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--; ... |
#include <bits/stdc++.h> using namespace std; const int M = 1000000007; const int MM = 998244353; const long double PI = acos(-1); long long power(long long b, long long e, long long m) { if (e == 0) return 1; if (e & 1) return b * power(b * b % m, e / 2, m) % m; return power(b * b % m, e / 2, m);... |
`default_nettype none
`include "irq.h"
/****
HOLD
0 START
1 MOVE_K2U
1 MOVE_UK
2 EMD
*/
module execute_exception_check_inst(
//Execute Module State
input wire iPREV_STATE_NORMAL,
//Previous Instruxtion
input wire iPREV_FAULT_PAGEFAULT,
input wire iPREV_FAULT_PRIVILEGE_ERROR,
input wire iPREV_FAULT_INVA... |
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1000 * 100 + 10; int to[N], nxt[N], idx[N], tot; int rnk[N], sz[N]; bool visited[N]; int minsz, center; void add_edge(int u, int v) { ++tot; to[tot] = v; nxt[tot] = idx[u]; idx[u] = tot; } int compute_size(int node, int pa... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e5; int a[100][100]; int main() { int n, i = 0; cin >> n; cin >> a[i / n][i % n]; i++; a[i / n][i % n] = (i >= n * n ? INF : a[i / n][i % n]); cin >> a[i / n][i % n]; i++; a[i / n][i % n] = (i >= n * n ? INF : a[i / n... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/06/11 11:02:56
// Design Name:
// Module Name: lab5_2_1
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revi... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int T = clock(); long long int a, ta, b, tb; cin >> a >> ta >> b >> tb; string s; cin >> s; long long int i =... |
#include <bits/stdc++.h> int num[10000]; int map[2000][2000]; int add(int a, int b, int c) { map[a][b] = 1, map[b][a] = 1; } int vis[2000][2]; int main() { int n; while (scanf( %d , &n) != EOF) { memset(map, 0, sizeof(map)); memset(vis, 0, sizeof(vis)); int i, j; int len = 0; ... |
`timescale 1ns/1ns
`include "aluop_def.v"
module ShiftRight(
input signed [31:0] inp,
input [4:0] shamt,
input isSrl,
output [31:0] out
);
assign out = (isSrl)? $signed(inp>>shamt):
... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); if (n % 2 == 0) printf( Mahmoud ); else printf( Ehab ); } |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7, N = 1e5 + 10; void test() { string s; cin >> s; vector<ll> cnt(26); for (auto c : s) { cnt[c - a ]++; } ll m; cin >> m; vector<ll> b(m); for (ll i = 0; i < m; i++) { cin >... |
#include <bits/stdc++.h> const int MAXN = 4e5 + 5, MAXLOG = 20, MAXS = MAXN * 50; template <typename _T> void read(_T &x) { x = 0; char s = getchar(); int f = 1; while (s > 9 || s < 0 ) { if (s == - ) f = -1; s = getchar(); } while (s >= 0 && s <= 9 ) { x = (x << 3... |
#include <bits/stdc++.h> using namespace std; const int N = 56; int n, a[N]; int cnt(int x) { int ans = 0; for (int i = 1; i <= n; ++i) ans += (a[i] == x); return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n; for (int i =... |
#include <bits/stdc++.h> using namespace std; const int N = 25, M = 300005; int n, a[N][N]; long long f[M], g[N][M], d[N][M], dp[N][M]; map<long long, long long> mp; string st; inline int bp(int x) { return __builtin_popcount(x); } void dfs(int p, int s, int x, long long m) { if (s == n) { lon... |
/**
* 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... |
module SigmaDeltaPhasedArray #(
parameter NUM_CH = 64, ///< Number of input channels
parameter ADDR_WIDTH = 8, ///< Depth of sample buffers
parameter OUT_WIDTH = 16, ///< Width of output signal
parameter OUT_DELAY = 3 ///< Specified delay between cmdIn/invertBit and dataOut
)
(
input clk,
... |
#include <bits/stdc++.h> using namespace std; const long long MX = 1e5 + 9; long long par[MX], num[MX]; void MS(long long v) { par[v] = v, num[v] = 1; } long long FS(long long v) { if (par[v] == v) return v; return par[v] = FS(par[v]); } void US(long long a, long long b) { a = FS(a), b = FS(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 la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { long long n, one = 0, z = 0; string s, s1; cin >> n >> s; if (n == 1) { cout << s << endl; continue; } fo... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int fa[N], mx[N], n; vector<int> son[N]; vector<int> ans; bool cmp(const int x, const int y) { return mx[x] < mx[y]; } void dfs(int x) { int s = son[x].size(); for (int i = 0; i < s; ++i) { int& sn = son[x][i]; dfs(sn... |
#include <bits/stdc++.h> using namespace std; int n; int a[120000]; void query(int L, int R) { int M = (L + R) / 2; printf( ? %d n , M); fflush(stdout); printf( ? %d n , n / 2 + M); fflush(stdout); scanf( %d %d , a + M, a + M + n / 2); if (a[M] == a[n / 2 + M]) { printf( ! %d n... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; using ll = long long; using db = long double; using str = string; using pi = pair<int, int>; using pl = pair<ll, ll>; using pd = pair<db, db>; using vi = vector<int>; using vb = vector<bool>; usin... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); long long t; cin >> t; while (t--) { vector<long long> A(3); for (auto &a : A) cin >> a; sort((A).begin(), (A).end(), greater<long long>()); long long a, b, c; a = A[... |
//////////////////////////////////////////////////////////////////
// //
// Barrel Shifter for Amber 2 Core //
// //
// The design is optimized for Altera family of FPG... |
#include <bits/stdc++.h> using namespace std; const long long N = 5e5 + 10; int n, a[N], b[N], c[N], p[N]; vector<int> v; int main() { cin >> n; for (int i = 1; i < N; i++) p[i] = i; for (int i = 1; i <= n; i++) { cin >> a[i] >> b[i]; if (a[i] == 2) cin >> c[i]; } for (int i = ... |
// -*- Mode: Verilog -*-
// Filename : testbench.v
// Description : UART RTL Test bench
// Author : Philip Tracton
// Created On : Mon Apr 20 16:05:13 2015
// Last Modified By: Philip Tracton
// Last Modified On: Mon Apr 20 16:05:13 2015
// Update Count : 0
// St... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; struct ppi { long long max; int id; int w; } pp1; struct pi { int le; int ri; int max; int id; } pp[maxn << 2]; void build(int tot, int le, int ri) { pp[tot].le = le; pp[tot].ri = ri; pp[tot].max... |
// 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 : Tue May 30 22:27:55 2017
// Host : GILAMONSTER running 64-bit major release (... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 22:29:00 09/09/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #4 Project
// Module Name: ... |
#include <bits/stdc++.h> using namespace std; long long l, r, ans; vector<long long> lucky; void lu(int f, int s) { string x = ; for (int i = 0; i < f; i++) x += 4 ; for (int i = 0; i < s; i++) x += 7 ; do lucky.push_back(atoll(x.c_str())); while (next_permutation(x.begin(), x.end())); ... |
`define MAX_VAL_P 7
`define INIT_VAL_P 0
`define MAX_STEP_P 1
`include "bsg_defines.v"
/**************************** TEST RATIONALE *******************************
1. STATE SPACE
This test module tests the outputs of DUT for a complete count-cycle
i.e., from INIT_VAL_P to MAX_VAL_P and then from MAX_VAL_P to IN... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int N = 710; string s; int n, t[N]; stack<int> st; struct node { long long f[3][3]; void init() { for (int i = 1; i <= 2; i++) f[i][0] = f[0][i] = 1; } node() { memset(f, 0, sizeof(f)); } void mergein... |
#include <bits/stdc++.h> using namespace std; int main() { int hh, mm, h, d, c, n; cin >> hh >> mm; cin >> h >> d >> c >> n; float a; if (h % n == 0) a = (h / n) * c; else a = (h / n + 1) * c; float b; int tim = hh * 60 + mm; if (tim <= 1200) { h += (1200 - tim)... |
// ============================================================================
// Copyright (c) 2013 by Terasic Technologies Inc.
// ============================================================================
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for... |
`timescale 1ns/100ps
// -----------------------------------------------------------------------------
// One-level up Hierarchical module
// -----------------------------------------------------------------------------
module a_h
// Verilog 2001 style
#(parameter M=5, N=3)
(
// Outputs
output [N-1:0] [M... |
#include <bits/stdc++.h> using namespace std; void fun(long long a[], long long remain, long long total, long long n, long long m) { vector<long long> ans; long long i, j; for (i = 0; i < n && total > 0; i++) { if (a[i] % m == remain) { ans.push_back(a[i]); total--; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; long long k; cin >> k; vector<int> a(n); int i; int mx_pos = -1; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == n) { mx_pos = i; } } ... |
#include <bits/stdc++.h> using namespace std; std::mt19937 rnd( (int)std::chrono::steady_clock::now().time_since_epoch().count()); long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXH = 200000; const int MAXW = 200000; const int MAXQ = 200000; int h, w, nq; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; const int inf = 0x3f3f3f3f; long long dp[maxn]; int n, m; struct node { int lb, lu; long long w; }; vector<node> ve[maxn]; int lb, lu; long long w, cost[maxn]; struct seg { long long ma, lazy; } tr[maxn << 2]; ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: uart_fifo_64x128.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ==========================... |
/*
* 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; using ll = long long; using ull = unsigned long long; int n; int cnt[1 << 20]; int cnt2[1 << 20]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n; ll res = 0; ++cnt2[0]; for (int pref = 0, a, i = 1; i <= n; +... |
/*
* 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; long long int s, sum = 0; cin >> n >> s; long long int* v = new long long int[n]; for (int i = 0; i < n; i++) { cin >> v[i]; sum += v[i]; } if (s > sum) cout << -1 << endl; else { sort(v, v + n)... |
#include <bits/stdc++.h> using namespace std; int arr[100001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); int cur = 1; for (int i = 0; i < n; i++) { if (cur <= arr... |
/*
* 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 law... |
module testmod ();
always_comb begin
unique case (eeee)
ZERO[1:0] : begin
a = 1;
end // case: ZERO[1:0]
ONE[1:0] : begin
a = 1;
end // case: ONE[1:0]
TWO[1:0] : begin
a = 1;
end // case: TWO[1:0]
THREE[1:... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1050; int dp[maxn][9], nxt[maxn][9][maxn], a[maxn], n, cnt[9]; inline int ask(int k) { return (1 << (k - 1)); } int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); for (int i = 1; i <= n; ++i) { for (in... |
#include <bits/stdc++.h> using namespace std; int n, temp, k = 0, input[1001], a[1001]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> temp; a[temp]++; if (a[temp] == 1) input[k++] = temp; } sort(input, input + k); for (int i = 2; i < k; i++) { if (input[i]... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int maxn = n * n - 1; int c = 0; for (int i = 0; i <= maxn; i++) { if (i % 2 == 0) { cout << i << ; c++; } if (c == n) { cout << endl; c = 0; } } for (in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.