text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; void solve() { int n; cin >> n; int a, b, c; cin >> a >> b >> c; string s; cin >> s; int ap = 0, bp = 0, cp = 0; for (auto i : s) { if (i == R ) ap++; else if (i == P ) bp++; ... |
/*
* DSI Core
* Copyright (C) 2013-2014 twl <>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; int dist[501][501]; int INF = 1000000000; int s[501][501]; int c[501][501]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { dist[i][j] = INF;... |
#include <bits/stdc++.h> using namespace std; long long x, y, z, t1, t2, t3; int main() { scanf( %lld%lld%lld%lld%lld%lld , &x, &y, &z, &t1, &t2, &t3); puts(abs(x - y) * t1 >= abs(x - y) * t2 + abs(x - z) * t2 + 3 * t3 ? YES : NO );... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; int n, k, maxn = 2000000001; int b[100001]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for (int i = 0; i < k; i++) { int r = (n - (k - i) * (k - i - 1) / 2) / (k - i); if (r <= 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 la... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; while (cin >> n) { vector<int> v; int x; for (int i = 0; i < n; i++) { cin >> x; v.push_back(x); } bool in = false; int cnt = 0; bool f = true; bool s = false, l = false; ... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated ... |
// diseño de una fifo ciclica, para implementar en cada bloque de proyecto
// ferney alberto beltran 2016 electrónica digital 1 universidad Nacional
module fifo
#(
parameter adr_width = 5,
parameter dat_width = 8
)
(
input clk, reset,
input rd1, wr1,
input [dat_width-1:0] data_i... |
// Simple verilog simulation of an openFIRE core
// instantiated without fsl nor interruptions
`timescale 1ns/1ns
module Test_openFIRE;
reg clock, reset;
wire [31:0] dmem_addr;
reg [31:0] dmem_data_in;
wire [31:0] dmem_data_out;
wire dmem_we;
wire dmem_re;
wire [1:0] dmem_input_sel;
reg dmem_done;
wire [31:0] imem... |
#include <bits/stdc++.h> using namespace std; long long int input(long long int n, vector<long long int> &ve); long long int input(long long int n, vector<long long int> &ve) { long long int val; for (long long int i = 0; i < n; i++) { cin >> val; ve.push_back(val); } return 0; } i... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int L, v, l, r, d; cin >> L >> v >> l >> r; if (r == l && r % v == 0) d = 1; else d = r / v - (l - 1) / v; cout << L / v - d << n ; } return 0; } |
//Legal Notice: (C)2018 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... |
#include <bits/stdc++.h> using namespace std; int a[2010]; long long C[2010][2010]; long long A[2010]; bool use[2010]; int n, m, N; void init() { memset(use, 0, sizeof(use)); C[0][0] = 1; for (int i = 1; i <= 2000; ++i) C[i][0] = 1; for (int i = 1; i <= 2000; ++i) for (int j = 1; j <... |
// DEFINES
`define BITS0 9 // Bit width of the operands
`define BITS1 8 // Bit width of the operands
`define BITS2 18 // Bit width of the operands
`define BITS3 36 // Bit width of the operands
// sees if the softaware matches simple primitives
module bm_match2_str_arch(clock,
reset... |
//-----------------------------------------------------------------------------
// Pretend to be an ISO 14443 tag. We will do this by alternately short-
// circuiting and open-circuiting the antenna coil, with the tri-state
// pins.
//
// We communicate over the SSP, as a bitstream (i.e., might as well be
// unf... |
#include <bits/stdc++.h> using namespace std; using namespace rel_ops; const int inf = ~0u >> 2; const long long INF = ~0ull >> 2; const double err = 1e-11; const double pi = acos(-1); inline long long read() { long long x; if (scanf( %lld , &x) == -1) exit(0); return x; } inline double re... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 2e5 + 5; vector<int> adj[Maxn]; int sz[Maxn]; int n; long long ret, ans; void dfs_init(int u, int f) { sz[u] = 1; for (int i = 0; i < adj[u].size(); i++) { int v = adj[u][i]; if (v == f) continue; dfs_init(v, u); ... |
#include <bits/stdc++.h> using namespace std; template <typename T, size_t N> struct ma : array<T, N> { T &operator[](size_t n) { return (*static_cast<array<T, N> *>(this))[n]; } }; template <class T> string to_str(const T &a) { ostringstream os; os << a; return os.str(); } template <> ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-6; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) {... |
#include <bits/stdc++.h> using namespace std; int main() { double n, m; cin >> n >> m; printf( %.10lf n , n * pow(1.000000011, m)); return 0; } |
//#############################################################################
//# Function: BCD Seven Segment Decoderh #
//#############################################################################
//# Author: Andreas Olofsson #
... |
// --------------------------------------------------------------------
// Copyright (c) 2005 by Terasic Technologies Inc.
// --------------------------------------------------------------------
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for all Terasic De... |
#include <bits/stdc++.h> using namespace std; bool comp(int& a, int& b) { return b < a; } int main() { int n; cin >> n; vector<pair<int, int>> source(n), team1, team2; long long sum_team1 = 0, sum_team2 = 0; for (int i = 0; i < n; ++i) { cin >> source[i].first; source[i].second = i... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (lin64) Build Mon Oct 10 19:07:26 MDT 2016
// Date : Thu May 4 16:19:46 2017
// Host : david-desktop-arch running 64-bit unknown
/... |
/*
* Copyright (c) 2000 Peter monta ()
*
* 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)
* an... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; long long score, sum = 0; cin >> n; vector<int> ara(n); for (int i = 0; i < n; i++) { cin >> ara[i]; sum += ara[i]; } sort(ara.begin(), ara.end()); reverse(ara.begin(), ara.end()); score = sum; f... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 1 << 30; int n, m, str[100100], lim[100100], up[100100], D[100100], col[100100 * 4]; long long ans; vector<int> F[100100 * 4]; vector<long long> sum2[100100 * 4], sum[100100 * 4]; bool cmp(int x, int y) { return D[x] > D[y]; } void build(int... |
#include <bits/stdc++.h> using namespace std; char mat[6][40]; int t[6], n, v[6]; int solve() { if (t[v[4]] != t[v[1]] + t[v[3]] - 1) return 0; if (t[v[5]] != t[v[0]] + t[v[2]] - 1) return 0; if (mat[v[0]][0] != mat[v[1]][0]) return 0; if (mat[v[0]][t[v[0]] - 1] != mat[v[4]][0]) return 0; if... |
#include <bits/stdc++.h> using namespace std; int n1, n2; int k1, k2; int main() { cin >> n1 >> n2 >> k1 >> k2; if (n1 > n2) cout << First << endl; else cout << Second << endl; return 0; } |
//*****************************************************************************
// (c) Copyright 2008 - 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 property
/... |
#include <bits/stdc++.h> using namespace std; int n, k; vector<int> digits; vector<vector<bool>> dp; vector<int> bin_digits; bool can; void In() { cin >> n >> k; digits.resize(n); string next; for (int i = 0; i < n; i++) { cin >> next; digits[i] = stoi(next, 0, 2); } } ... |
#include <bits/stdc++.h> using namespace std; long long int MAX3(long long int x, long long int y, long long int z) { long long int t = max(x, y); return max(t, z); } long long int power(long long int x, long long int n) { long long int i, ans = 1; for (i = 1; i <= (n); i += 1) { ans = ans... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_1r1w_16x10.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it an... |
#include <bits/stdc++.h> using namespace std; const int N = 100; int n, x, t; long long ans, s[N]; int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &x); t = 0; while (x) { t += x % 2; x /= 2; } ++s[t]; } for (int i = 1; i <=... |
module scheduler_router(clk, rst, wen, Data_in_N, Data_in_S, Data_in_W, Data_in_E, Data_in_ready_N, Data_in_ready_S, Data_in_ready_W,
Data_in_ready_E, Data_out_N, Data_out_S, Data_out_W, Data_out_E,
Data_out_ready_N, Data_out_ready_S, Data_out_ready_W, Data_out_ready_E,
Data_out_valid_N, Data_out_valid_S, Data_out_... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; int n; vector<set<int> > g(200000); vector<int> used(200000); int main() { int n, m, k; cin >> n >> m >> k; vector<int> x(m); vector<int> y(m); for (int i = 0; i < m; i++) { cin >> x[i] >> y[i]; x[i... |
#include <bits/stdc++.h> using namespace std; const long long base = 1e9 + 7; const long long MAX_N = 2e5 + 7; long long dd2[MAX_N]; void Solves() { long long n, k; cin >> n >> k; long long l[n + 1]; long long r[n + 1]; priority_queue<pair<long long, long long>, vector<p... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// Take CRC data and apply t... |
#include <bits/stdc++.h> using namespace std; const int M = (int)1e9 + 7; const int N = (int)2e5 + 5; struct trio { long long a; long long b; long long c; }; trio dp[2][N]; long long ps[N]; int main() { cout.precision(15); cout.setf(ios::fixed); int n, k; int i; cin >> 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... |
#include<bits/stdc++.h> #define y1 dmytxdy #define pb push_back #define fi first #define se second #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; template <typ... |
#include <bits/stdc++.h> using namespace std; int main() { int x, d; cin >> x >> d; long long start = 1; vector<long long> arr; while (x > 0) { int toPrint = 1; while ((1LL << toPrint) - 1 <= x) toPrint++; toPrint--; for (long long i = start; i < start + toPrint; i++) arr... |
///////////////////////////////////////////////////////////////////////////////
//
// 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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of avfb_tc
//
// Generated
// by: wig
// on: Tue Apr 25 19:40:28 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
/... |
// DESCRIPTION: Verilator: Verilog Test for short-circuiting in generate "if"
//
// The given generate loops should only access valid bits of mask, since that
// is defined by SIZE. However since the loop range is larger, this only works
// if short-circuited evaluation of the generate loop is in place.
// This file O... |
/**
* 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 vowel(char c) { string s = aeiou ; for (int i = 0; i < 5; i++) if (c == s[i]) return true; return false; } bool rhyme(string s1, string s2, int k) { int i = s1.size() - 1, j = s2.size() - 1; int cnt = 0; while (i >= 0 && j >= 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 la... |
#include <bits/stdc++.h> using namespace std; inline int bit(int x, int i) { return (x >> i) & 1; } inline int two(int x) { return 1 << x; } int n, s[110], m, team[110], dp[20][1 << 20]; char op[110]; bool vis[20][1 << 20]; int go(int mi, int ban) { if (mi == m) return 0; int &ret = dp[mi][ban]; ... |
#include <bits/stdc++.h> using namespace std; long long RAND(long long n) { return abs((rand() << 15) + rand()) % n; } bool check(int i, int j, int n) { return ((i >= 0) && (j >= 0) && (i < n) && (j < n)); } int move_x[] = {1, 0}; int move_y[] = {0, 1}; vector<vector<vector<vector<bool>>>> solve(vecto... |
/*
Filename : EX2MEM.v
Compiler : Quartus II
Description : EX to MEM register
INPUT : clk, rst, EN, all active high
RegWrite_In, MemWrite_In, MemRead_In,
[31:0] PC_In, ALUOut_In, DataBusB_In
[4:0] AddrC_In,
[3:0] PCSrc_In,
[1:0] MemtoReg_In,
OUTPUT : RegWrite_Out, MemWrite_Ou... |
#include <bits/stdc++.h> using namespace std; void qmax(long long &x, int y) { if (x < y) x = y; } void qmin(long long &x, long long y) { if (x > y) x = y; } inline long long read() { char s; long long k = 0, base = 1; while ((s = getchar()) != - && s != EOF && !(isdigit(s))) ; ... |
/*===========================================================================*/
/* Copyright (C) 2001 Authors */
/* */
/* This source file may be used and distributed without restriction provided */
... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; int b[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; int c = 0, r = 0; for (int i = 0; i < n; i++) { if (a[i] == 0 and b[i] == 1) c++; if (a[i] == ... |
//------------------------------------------------------------------------------
// (c) Copyright 2013-2015 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 propert... |
//////////////////////////////////////////////////////////////////////
//// ////
//// CRC_chk.v ////
//// ////
//// This file is part of the Ether... |
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { string a; cin >> a; int sz = int(a.size()); for (__typeof(sz) i = 0; i < sz; i++) for (__typeof(sz) j = 0; j < sz; j++) if (a.substr(0, i) + a.substr(j + 1) == CODEFORCES ) { cout << YES n ; ... |
#include <bits/stdc++.h> using namespace std; int i, j, k, n, m, l; const int N = 1e5 + 8; int vis[N]; vector<int> adj[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> n; for (i = 1; i < n; i++) { int u, v; cin >> u >> v; adj[u].push_... |
#include <bits/stdc++.h> using namespace std; int T, N, val[53][53], rk[53][53], fr[103]; vector<int> peo[53]; int pos[53]; void go(bool flg) { queue<int> q; for (int i = 1; i <= N; ++i) { peo[i].clear(); for (int j = 1; j <= N; ++j) peo[i].push_back(j); sort(peo[i].begin(), peo[i].e... |
#include <bits/stdc++.h> using namespace std; const int M = 2e5 + 10; const int mod = 1e9 + 7; struct pairNode { char ch; long long times; pairNode(char ch = 0, long long times = 0) : ch(ch), times(times) {} ~pairNode() = default; bool operator==(const pairNode &rhs) const { return ch ... |
/**
* 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 mod = 998244353; int qmul(int a, int b) { a = (a % mod + mod) % mod; b = (b % mod + mod) % mod; int ans = 0; while (b) { if (b & 1) ans = (ans + a) % mod; a = (a << 1) % mod; b >>= 1; } return ans; } int qpow(int... |
`timescale 1ns/1ps
`include "../global.v"
module SigRegisterFile_tb();
reg clk;
reg reset;
reg writeEnableR0, writeEnableR1;
reg [31:0] writeValueR0, writeValueR1;
reg shiftEnableR0;
reg [3:0] readSelectA, readSelectB;
wire [31:0] readResultA, readResultB;
SigRegisterFile DUT(clk, r... |
#include <bits/stdc++.h> using namespace std; string s1, s2; set<char> st; vector<int> t[300]; int bin_search(char k, int ind) { int l = 0, r = t[k].size() - 1, m; while (l < r) { m = (l + r) / 2; if (ind == t[k][m]) return t[k][m]; if (ind < t[k][m]) r = m; else ... |
module MEMWB_Reg (
input clk,
input rst,
input flush,
input stall,
input [2-1:0] WB_ctrl_i,
output [2-1:0] WB_ctrl_o,
input [32-1:0] ALU_output_i,
output [32-1:0] ALU_output_o,
input [32-1:0] Mem_output_i,
output [32-1:0] Mem... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, k; cin >> n >> k; string second; cin >> second; vector<long long> cnt(k, 0); for (long long i = 0; i < n; i++) { cnt[second[i] - A ]++; } long long ans = cnt[0]; for (long long i = 0; i < k; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int bound = 400; struct qq { int id, vl; bool operator<(const qq &temp) const { return vl < temp.vl; } }; qq bk[210000 / bound][bound], ns; int nk[210000 / bound]; struct pp { int vl, id, min_value, value; int flag;... |
module intermediator_tb;
parameter INTERMEDIATOR_DEPTH = 1024;
parameter LOG2_INTERMEDIATOR_DEPTH = log2(INTERMEDIATOR_DEPTH - 1);
reg clk, rst, wr0;
reg [LOG2_INTERMEDIATOR_DEPTH - 1:0] row0;
reg [65:0] v0;
reg wr1;
reg [LOG2_INTERMEDIATOR_DEPTH - 1:0] row1;
reg [65:0] v1;
wire push_to_adder;
wire [LOG2_INTERMEDIATOR... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "utils/bus_to_ip.v"
`include "pulse_gen/pulse_gen.v"... |
#include <bits/stdc++.h> using namespace std; int main() { long long t, n; cin >> n; if (n == 0) cout << 1 << endl; else if (n % 4 == 1) cout << 8 << endl; else if (n % 4 == 2) cout << 4 << endl; else if (n % 4 == 3) cout << 2 << endl; else cout << 6 << endl... |
#include <bits/stdc++.h> int main() { int m = 0, i = 0, c[100], x, y, s1 = 0, s2 = 0, ans = 0; scanf( %d , &m); for (i = 0; i < m; i++) { scanf( %d , &c[i]); s1 += c[i]; } scanf( %d%d , &x, &y); for (i = 0; i < m; i++) { s1 -= c[i]; s2 += c[i]; if ((s1 >= x) && (s... |
/*
* 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/100ps
module testbench();
reg clock, reset;
initial begin clock=0; reset=1; end
always
begin
#10;
clock = !clock;
end
//
// Instantaite RLE...
//
reg enable, arm;
reg [1:0] rle_mode;
reg [3:0] disabledGroups;
reg [31:0] dataIn;
reg validIn;
wire [31:0] dataOut;
rle_enc rle... |
/*
* 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; constexpr int N = 5e5 + 5; vector<int> elm[N]; struct SegTree { struct Dat { int l, r; Dat *lc, *rc; long long lmx, rmx, mx, sum; int len() { return r - l + 1; } void fset(long long kval) { lmx = rmx = mx = sum = kval; } void ... |
#include <bits/stdc++.h> using namespace std; int n; set<string> s; int main() { cin >> n; getchar(); while (n--) { string ss; getline(cin, ss); s.insert(ss); } cout << s.size(); return 0; } |
module CacheDelay(clk, sigIn, waitCnt, sigOut);
/***
This delay works by caching a large number of signal inputs on clock (pos) edges, and selecting where in the time series to output based on the requested delay. The last element in the cache is popped, and the first (zeroth) element pushed, on every clock cycle.
Te... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const long double eps = 1e-7; const int inf = 1000000010; const long long INF = 10000000000000010LL; const int mod = 1000000007; const int MAXN = 100010; long long n, m, k, x, y, z, a, b, c, t1, t2, cnt, p; long long X[MAXN]; ... |
/**
* 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 = 2e5 + 10, MOD = 1e9 + 7; long long n, T, ni[MAXN], jie[MAXN], jie_ni[MAXN], A[MAXN], ans, sum; long long sum_N, sum_K; void Init() { ni[1] = 1; for (long long i = 2; i <= MAXN - 10; i++) { ni[i] = ((MOD - (MOD / i)) * ni[MOD % ... |
// (C) 1992-2014 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... |
#include <bits/stdc++.h> int n, m, sol; int D[100005]; int main() { scanf( %d %d , &n, &m); int p = 1; for (int i = 1; i <= m; ++i) { p = p + p; if (p >= 1000000009) p -= 1000000009; } D[1] = p - 1; for (int i = 2; i <= n; ++i) { int now = p - i; if (now < 0) now +=... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_b
//
// Generated
// by: wig
// on: Thu Jun 22 05:51:07 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../highlow.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author:... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using pil = pair<int, ll>; using pli = pair<ll, int>; using vs = vector<string>; using vvs = vector<vs>; using vvvs = vector<vvs>; using vb = vector<bool>; using vvb = vector<v... |
#include <bits/stdc++.h> int main() { char a[8][8]; char x, y; int i, j, b = 0; for (i = 0; i < 8; i++) for (j = 0; j < 8; j++) a[i][j] = 1; scanf( %c%c , &x, &y); x -= a ; y -= 1 ; a[x][y] = 0; for (i = 0; i < 8; i++) { a[x][i] = 0; a[i][y] = 0; } if (x... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 1ll; long long lim = 0, Ans = 0; struct Plan { long long pos; long long c, p; } a[N]; struct Tree { long long c, p; Tree() { c = p = 0; }; } t[N << 2ll]; struct Acht { long long a, b; Acht() { a = b = 0; }; ... |
#include <bits/stdc++.h> template <typename Y> inline bool updmin(Y &a, Y b) { if (a > b) { a = b; return 1; } return 0; } template <typename Y> inline bool updmax(Y &a, Y b) { if (a < b) { a = b; return 1; } return 0; } template <typename Y> inline Y abs(... |
//----------------------------------------------------------------------------
// Copyright (C) 2009 , Olivier Girard
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must re... |
#include<bits/stdc++.h> #define ll long long int #define mod 1000000007 using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int A[n]; for(int i=0;i<n;i++) { cin>>A[i]; } bool flag=tr... |
#include <bits/stdc++.h> using namespace std; long long int nextAlice[7][7]; long long int nextBob[7][7]; long long int nodeNum[7][7]; pair<long long int, long long int> curScore; pair<long long int, long long int> cycScore; pair<long long int, long long int> gameScore(long long int x, long long int y) { ... |
`timescale 1 ns / 1 ps
module pwm_v1_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Slave Bus Interface S00_AXI
parameter integer C_S00_AXI_DATA_WIDTH = 32,
parameter integer C_S00_AXI_ADDR_WIDTH = 4
)
(
// Users... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int i, j, k; int n, m, idx; string s, s2; cin >> s; n = s.length(); int cnt = 0; for (i = 0; i < n; i++) { if (s[i] == a ) cnt++; } k = 0; id... |
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); } void online_judge() { freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); } const int flag_max = 0x3f3f3f3f; const long long OO = 1e9; const doubl... |
/*
* 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... |
// File: MUX4_1_MS_TBV.v
// Generated by MyHDL 0.10
// Date: Sun Sep 23 18:20:41 2018
`timescale 1ns/10ps
module MUX4_1_MS_TBV (
);
// myHDL -> Verilog testbench for module `MUX4_1_MS`
reg x0 = 0;
reg x1 = 0;
wire y;
reg x2 = 0;
reg x3 = 0;
reg s0 = 0;
reg s1 = 0;
wire [68:0] x0TV;
wire [68:0] x1TV;
wire [68:0] x... |
#include <bits/stdc++.h> using namespace std; int blk_size; struct node { int l, r, id; long long int ans = 0; }; bool compare(node a, node b) { if (a.l / blk_size != b.l / blk_size) return (a.l) / blk_size < (b.l) / blk_size; return a.r < b.r; } bool compare2(node a, node b) { retur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.