text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { long long t, a, b; string s; scanf( %lld , &t); vector<int> v; while (t--) { v.clear(); scanf( %lld%lld , &a, &b); cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == 0 ) v.push_back(i); } ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { char c; bool nega = 0; while ((!isdigit(c = getchar())) && (c != - )) ; if (c == - ) { nega = 1; c = getchar(); } x = c - 48; while (isdigit(c = getchar())) x = x * 10 + 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... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2002; int n, k; long long a[MAXN]; int dp[MAXN]; int abs1(int a) { return a >= 0 ? a : -a; } int min1(int a, int b) { return a > b ? b : a; } bool find(long long mid) { for (int i = 1; i <= n + 1; i++) dp[i] = i - 1; dp[1] = 0; f... |
/**
* 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 <typename T> using minheap = priority_queue<T, vector<T>, greater<T>>; int main() { ios_base::sync_with_stdio(false); int t; cin >> t; while (t--) { long long w, h; cin >> w >> h; vector<vector<long long>> a(4); for (... |
#include <bits/stdc++.h> long long mpow(long long a, long long n, long long mod) { long long ret = 1; long long b = a; while (n) { if (n & 1) ret = (ret * b) % mod; b = (b * b) % mod; n >>= 1; } return (long long)ret; } using namespace std; vector<int> v, v1; pair<int, in... |
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int N = 1e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string x; cin >> x; int H = 0; for (char &c : x) if (c == H ) H++; int result = n; for (int 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_fifo.v ////
//// ////
//// This file is part of the Ether... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long mo = 998244353; const long long N = 2e6 + 5; long long n, m, noden, tot; set<long long> S; long long sum, pre1, pre2, ans, cnt; struct node { long long lc, rc, rnd, val, sz; } a[N]; long long giao[N]; ... |
// generated by gen_VerilogEHR.py using VerilogEHR.mako
// Copyright (c) 2019 Massachusetts Institute of Technology
// 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... |
#include <bits/stdc++.h> using namespace std; template <class T, class U> void maximize(T &x, U y) { if (x < y) x = y; } template <class T, class U> void minimize(T &x, U y) { if (x > y) x = y; } template <class T> T Abs(T x) { return (x < (T)0 ? -x : x); } namespace task { const 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> int main() { int n, h, m, h0, m0, c(1), cash(1); scanf( %d , &n); scanf( %d%d , &h0, &m0); while (--n) { scanf( %d%d , &h, &m); if (h == h0 && m == m0) { c += 1; if (c > cash) { cash = c; } } else { c = 1; } ... |
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(false); long long int n; cin >> n; vector<long long int> a(n), start(n), end(n); for (long long int i = 0; i < n; i++) { cin >> a[i]; start[i] = i; end[i] = i + 1; } for (long long int i = 0;... |
/*
* 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 maxn = 1e5 + 5; const int maxt = 1 << 20; int p[maxn], t[maxn]; bool vis[maxn], cut[maxn]; long long x[maxn], l[maxn], cal[maxn], bit1[maxt], bit2[maxt]; vector<int> son[maxn]; void dfs1(int u, long long rem) { rem -= l[u] << 1; for (int 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... |
#include <bits/stdc++.h> using namespace std; int N, ap[3009], dp[3009], how[3009]; char sir[3009]; bool cons(char c) { if (c == a || c == e || c == i || c == o || c == u ) return 0; return 1; } int main() { gets(sir + 1), N = strlen(sir + 1); dp[0] = 0; for (int i = 1; i <= N; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, i, j, count = 0; cin >> t; int a[t], b[t]; for (i = 0; i < t; i++) cin >> a[i] >> b[i]; for (int i = 0; i < t; i++) { int e = 0, f = 0, c = 0, d = 0; for (j = 0; j < t; j++) { if (a[i] < a[j] && b[i] == b[j]) 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... |
`timescale 1ns / 10ps
module simple_test ();
reg [3:0] a_in;
reg [3:0] b_in;
reg [3:0] s_in;
reg M_in,Ci_inverse_in;
wire [3:0] Y_out;
wire P_out,Q_out,Co_inverse_out,AequalsB_out;
ALU alu(a_in,b_in,s_in,M_in,Ci_inverse_in,P_out,Q_out,Co_inverse_out,Y_out,AequalsB_out);
integer i,j,k,l,m;
initial ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_t
//
// 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 !!!
//... |
#include <bits/stdc++.h> using namespace std; int n; int main() { cin >> n; if (n == 0) { printf( a ); return 0; } for (char c = a ; c <= z && n; c++) { int sum = 0, i; for (i = 0; i <= n; i++) { n -= i; cout << c; } } printf( n ); retu... |
/*
Copyright (c) 2017 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; template <typename T> void chkmax(T& x, T y) { if (x < y) x = y; } template <typename T> void chkmin(T& x, T y) { if (x > y) x = y; } inline int read() { int x = 0; char c = getchar(); bool f = 0; while (c < 48) f |= c == - , c = get... |
#include <bits/stdc++.h> using namespace std; int n, a[50100]; long long m, ans; struct node { int s, cnt[30]; node *ch[2]; node(); } * tp, *nul, *root[50100]; int getint() { char ch; while (!isdigit(ch = getchar())) ; int x = ch - 0 ; for (; isdigit(ch = getchar()); x = x... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m; cin >> n >> m; long long int kmin = 0; long long int kmax = 0; long long int left; kmax = ((n - m + 1) * (n - m)) / 2; long long int j = n / m; left = n % m; kmin = (m - left) * ((j) * (j - 1) / 2) + l... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:01:16 03/06/2017
// Design Name: DFF
// Module Name: D:/Projects/XilinxISE/HW1/Homework1/testDFF.v
// Project Name: Homework1
// Target Device:
// Tool versions... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (lin64) Build Mon Jan 23 19:11:19 MST 2017
// Date : Sun Mar 26 22:18:09 2017
// Host : andrewandrepowell2-desktop running 64-bit U... |
#include <bits/stdc++.h> using namespace std; void Fast_IO() { ios::sync_with_stdio(0); cin.tie(0); } long long gcd(long long a, long long b) { if (a == 0) return b; return gcd(b % a, a); } long long lcm(long long a, long long b) { if (a == 0 || b == 0) return 0; return ((a / gcd(a, ... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long mod2 = 998244353; long long mod3 = 1000003; long long mod4 = 998244853; long long mod5 = 1000000009; long long inf = 1LL << 60; double pi = 3.141592653589793238462643383279L; double eps = 1e-9; int dh[4] = {1, -1, 0,... |
#include <bits/stdc++.h> using namespace std; vector<int> darmo; vector<pair<int, int> > tab; vector<bool> done; vector<int> wolne; int n, k; int main() { scanf( %d %d , &n, &k); darmo.resize(n); tab.resize(n); done.resize(k + 1, false); long long res = 0; for (int i = 0; i < n; i+... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Mar 31 09:04:41 2017
// Host : Shaun running 64-bit major release (bu... |
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; using ld = long double; using uint = uint32_t; const double EPS = 1e-8; const int INF = 0x3F3F3F3F; const ll LINF = 4611686018427387903; const int MOD = 1e9 + 7; const int mod = 1e6 + 3; vector<vector<ll>> mat(... |
// --------------------------------------------------------------------------------
//| Avalon Streaming Channel Adapter
// --------------------------------------------------------------------------------
`timescale 1ns / 100ps
module soc_system_hps_only_master_p2b_adapter (
// Interface: clk
input ... |
/**
* 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 double PI = acos(-1); const int maxn = 5e5; struct line { double x, y; } A[maxn]; long long X, Y, R; double x0, Y0, v, T, d, x, y, r, M, D; double a, b, now, ans, th, l, Max; int i, n, la; double sqr(double x) { return x * x; } double dist(do... |
`include "constants.vh"
`default_nettype none
module rs_requestgenerator
(
input wire [`RS_ENT_SEL-1:0] rsent_1,
input wire [`RS_ENT_SEL-1:0] rsent_2,
output wire req1_alu,
output wire req2_alu,
output wire [1:0] req_alunum,
output wire req1_branch,
output wire req2_branch,
outpu... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long ret =... |
`timescale 1ns / 1ps
//File: vsyncModule.v
//Author: Adam Michael, CM1884
// Mohammad Almisbaa, CM2060
//Date: November 5, 2015
//The line increment is synchronized with the hsync pulse
//synch pulse is generated at the end of the line: Active Video-BackPorch-SynchPulse-FrontPorch
//this is how it is done by ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void checkmin(T &a, T b) { if (a > b) a = b; } template <class T> inline void checkmax(T &a, T b) { if (a < b) a = b; } const int oo = 1 << 30; const double eps = 1e-7; const int N = 1 << 10; const int M = 1; const l... |
module AddSubCmp #(
parameter Width = 16
) (
(* intersynth_conntype = "Bit" *)
input AddOrSub_i,
(* intersynth_conntype = "Word" *)
input[Width-1:0] A_i,
(* intersynth_conntype = "Word" *)
input[Width-1:0] B_i,
(* intersynth_conntype = "Word" *)
output[Width-1:0] D_o,
(* intersynth_conntype = "Bit" ... |
module test();
// task with no lifetime, return-type, or port-list
task t0;
blah0;
endtask // t0
// empty port-list
task t1();
blah1;
endtask // t1
// non-empty portlist
task t2(stuff2);
blah2;
endtask // t2
// test that ": task_identifier" remains unscath... |
/* verilator lint_off WIDTH */
module IDELAYE2 (/*AUTOARG*/
// Outputs
CNTVALUEOUT, DATAOUT,
// Inputs
C, CE, CINVCTRL, CNTVALUEIN, DATAIN, IDATAIN, INC, LD, LDPIPEEN,
REGRST
);
parameter CINVCTRL_SEL = "FALSE"; // Enable clock inversion
parameter DELAY_SRC = "IDATAIN";... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; int lz[N << 2][10]; long long sum[N << 2][10], tmp[10]; void push_up(int rt) { for (int i = 0; i < 10; ++i) sum[rt][i] = 0; for (int i = 0; i < 10; ++i) sum[rt][lz[(rt << 1)][i]] += sum[(rt << 1)][i]; for (int i = 0; i < 10; ++i)... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << ; return *this; } } dbg; long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); } int main() { int n, k; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)2e18; const int N = 1005; char s[N]; int lcp[N][N]; vector<pair<int, int>> segs; bool cmp(pair<int, int> a, pair<int, int> b) { int alen = a.second - a.first; int blen = b.second - b.first; int clen = min(alen, blen... |
#include <bits/stdc++.h> #pragma optimization_level 3 #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int getChar() { static char buf[1 << 16]; static int pos = 0, size = 0; if (pos == size... |
/**
* 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 inf = 1e18 + 239; vector<long long> used; vector<vector<pair<long long, long long> > > gr; long long ans = -inf; vector<long long> dp; long long n; void dfs(long long p1) { used[p1] = 1; if (gr[p1].size() == 1 && p1 != 0) { ans ... |
/**
* 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:
// Engineer:
//
// Create Date: 07/02/2016 05:02:20 PM
// Design Name:
// Module Name: V_DESNORM_FIXED_TO_FLOAT
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Depende... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); long long n, d; cin >> n >> d; long long a[105] = {0}; long long pref[105] = {0}; for (long long i = 1; i <= n; i++) { cin >> a[i]; if (a[i] % 2 != 0) pre... |
// Audio_0.v
// This file was auto-generated as part of a SOPC Builder generate operation.
// If you edit it your changes will probably be lost.
`timescale 1 ps / 1 ps
module Audio_0 (
input wire iWR_CLK, // clk.clk
output wire oAUD_DATA, // avalon_slave_0_export.export
o... |
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { return a < b ? (a = b, 1) : 0; } template <class T> inline bool chmin(T &a, T b) { return a > b ? (a = b, 1) : 0; } int main() { int n, m; cin >> n >> m; map<int, vector<int>> obs; 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 "hrfp_defs.vh"
module hrfp_compare
#(parameter PIPELINESTAGES=5)
(input wire clk,
input wire [`MSBBIT:0] op_a, op_b,
output reg b_is_bigger,
output reg [`MSBBIT:0] op1_a, op1_b);
genvar i;
wire [35:0] propagate;
wire [35:0] newcarry;
... |
#include <bits/stdc++.h> using namespace std; inline int gi() { int w = 0, q = 0; char c = getchar(); while ((c < 0 || c > 9 ) && (c != - )) c = getchar(); if (c == - ) q = 1, c = getchar(); while (c >= 0 && c <= 9 ) w = w * 10 + c - 0 , c = getchar(); return q ? -w : w; } int 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 la... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic Wishbone controller for ////
//// Single-Port Synchronous RAM ////
//// ... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_MATLAB_Function_block.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ---------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, sum = 1; cin >> n >> a >> b; if (n == 1) { puts( 1 ); return 0; } if (b == 0 && a == n - 1) { puts( -1 ); return 0; } bool fl = (b == 0); int now = 1; vector<long long> ans(n, 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... |
`timescale 1ns/10ps
/*
功能:示波器触发器
输入:nrst-0复位
clk-时钟
wave_trig-波形触发输入
wave_bypass-1不关心波形触发
la_trig-逻辑触发输入
trig_clr-清除触发状态
输出:trig_sta-触发状态输出,1已触发
trig_pluse-触发脉冲输出
修改:eleqian 2016-01-20
*/
module dso_trig(nrst, clk, wave_trig, wave_bypass, la_trig, ext_trig, ext_bypass,
tri... |
#include <bits/stdc++.h> using namespace std; int dp[1010][1010][11][2]; int main() { ios_base::sync_with_stdio(0); int n, m, k; cin >> n >> m >> k; int kk = k; string a, b; cin >> a >> b; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (a[i - 1] == b[j -... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; void solve(int tc) { int n, k; cin >> n >> k; string s; cin >> s; for (int i = k; i < s.size(); i++) { if (s[i] == ? ) { if (s[i - k] != ? ) { s[i] = s[i - k]; } } else { if (... |
/*
* 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; template <class T> T abs(T x) { return x > 0 ? x : -x; } int n, m; int a[1 << 20]; int t[1 << 20]; void upd(int v, int val) { v += 1 << n; t[v] = val; v /= 2; bool cur = 0; while (v > 0) { if (cur == 0) t[v] = t[2 * v] |... |
#include <bits/stdc++.h> using namespace std; int root[1000100]; unordered_map<int, int> mp[1000100]; pair<pair<int, int>, int> edge[1000100]; int cnt[1000100]; int find_root(int u) { if (root[u] == u) return u; return root[u] = find_root(root[u]); } bool cmp(pair<pair<int, int>, int> u, pair<pa... |
#include <bits/stdc++.h> using namespace std; int main() { string s; long long int n; cin >> n; getline(cin, s); getline(cin, s); long long int l = s.length(); long long int a = 0, ii = 0, f = 0; for (long long int i = 0; i < l; i++) { if (s[i] == A ) { a++; } el... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const int maxn = 5e1 + 10; const int maxq = 1e3 + 10; const int alf = 26; const long long dlm = 1e9 + 7; const int del = 998244353; const int eps = 1e-7; char t[maxn][maxn]; char g[maxn][maxn]; char t2[maxn][maxn]; int ... |
#include <bits/stdc++.h> using namespace std; const int MXN = 1000100; const long long inf = 1e15; const int mod = 1000000007; char s[MXN]; int was[2 * MXN]; int main() { scanf( %s , s); int n = strlen(s); if (s[n - 1] == L ) { for (int i = 0; i < (n); i++) { if (s[i] == R ) ... |
module tone_lut32 (input [5:0] tone, output [15:0] thirty_second_period);
//these constants define the number of 100Mhz cycles needed to emulate each note frequency, divided by 32 to get
//a 32th of the waveform, to use PWM accurately
parameter
C3 = 16'd23890,
C3S = 16'd22549,
D3 = 16'd21283,
D3... |
#include <bits/stdc++.h> using namespace std; int N, M, C, a[100009]; int res(int p1, int p2, int p3) { int s = 0; if (p1 > p2) s += (p2 - p1); if (p2 > p3) s += (p3 - p2); return s; } void solve(int s) { int G; cin >> G; if (G <= C / 2) { for (int i = 1; i <= N; i++) { ... |
// Quartus Prime Verilog Template
// Single port RAM with single read/write address and initial contents
// specified with an initial block
module phyIniCommand1_and
#(parameter DATA_WIDTH=16, parameter ADDR_WIDTH=4)
(
input [(DATA_WIDTH-1):0] data,
input [(ADDR_WIDTH-1):0] addr,
input we, clk,
... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while (t--) { long long n, m; cin >> n >> m; long long ans = (n * (n + 1)) / 2; long long x = (n - m) / (m + 1); long long y = (n - m) ... |
//==================================================================================================
// Filename : Comparators.v
// Created On : 2016-09-22 10:07:30
// Last Modified : 2016-09-22 14:51:38
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico de... |
/**
* 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 N = 200005; int n, m; long long ans, a[N], b[N]; char c; long long read() { long long x = 0; int sig = 1; for (c = getchar(); c < 0 || c > 9 ; c = getchar()) if (c == - ) sig = -1; for (; c >= 0 && c <= 9 ; c = getchar()) x... |
module IOBUFDSE3 #(
`ifdef XIL_TIMING
parameter LOC = "UNPLACED",
`endif
parameter DIFF_TERM = "FALSE",
parameter DQS_BIAS = "FALSE",
parameter IBUF_LOW_PWR = "TRUE",
parameter IOSTANDARD = "DEFAULT",
parameter integer SIM_INPUT_BUFFER_OFFSET = 0,
parameter USE_IBUFDISABLE = "FALSE"
)(
output O,
inou... |
#include <bits/stdc++.h> using namespace std; template <class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template <class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } const int MAXN = 52; const int MAXM = 113; const int MAXT = 20013; const int INF = 1000000007; con... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2017/07/25 17:45:20
// Design Name:
// Module Name: sortx16_sim
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
//... |
////////////////////////////////////////////////////////////////
// File: rgb_to_grayscale.v
// Author: T. Dotsikas, B. Brown
// About: Fixed point RGB to grayscale conversion.
////////////////////////////////////////////////////////////////
`timescale 1ns/1ns
module rgb_to_grayscale #(
parameter rgb_width = 10
)... |
#include <bits/stdc++.h> using namespace std; int n, m; long long a, b[100100], p[100100]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m >> a; for (int i = 1; i <= n; i++) cin >> b[i]; for (int i = 1; i <= m; i++) cin >> p[i]; sort(b + 1, b + ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = int(2.1e5); vector<pair<int, int>> g[N]; int n, q; ll res = 0; class dsu { public: using T = int; vector<int> p; vector<ll> sz; int n; dsu(int _n) : n(_n) { p.resize(n); sz.resize(n); ... |
// (C) 1992-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulati... |
/*
* 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; template <class T> inline void minu(T& x, T y) { x = min(x, y); } template <class T> inline void maxu(T& x, T y) { x = max(x, y); } inline long long bit(long long n) { return 1LL << n; } template <class T> ostream& operator<<(ostream& os, vector<... |
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Logic Core: PCI Express Megacore Function
// Company: Altera Corporation.
// www.altera.com
// Author: IPBU... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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... |
// pg_sequencer.v
`timescale 1ns / 1ps
module pg_sequencer
(
input clk,
input sync,
input reset,
input enable,
input start,
output reg running,
output reg [5:0]pgout,
output reg [7:0]ip, // command index pointer
input [15:0]cmd
);
/* command word structure
15 14 13 12 11 10 9 8 7 6 ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e+5; bool vis[maxn]; int main() { int T, n, m, l; cin.sync_with_stdio(false); cout.sync_with_stdio(false); cin.tie(0); cout.tie(0); while (cin >> n) { memset(vis, false, sizeof vis); int pos = n; int now = ... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) int32_t main() { ios::sync_with_stdio(false); cin.tie(0); long long a, b; cin >> a >> b; lon... |
#include <bits/stdc++.h> using namespace std; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << ; cout << endl; } int ans[100000 + 10]; int main() { for (int N; ~scanf( %d , &N);) { memset(ans, 0, sizeof(ans)); vector<int> a(N), b(N); for (int 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 main() { int n, k; cin >> n >> k; vector<int> a(n); priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; long long sum = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; sum +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.