text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:23:38 11/08/2013
// Design Name:
// Module Name: top_module
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
#include <bits/stdc++.h> using namespace std; string s; void rd() { cin >> s; if (s != start ) exit(0); } int q(int x, int y) { cout << ? << x << << y << endl; cin >> s; if (s[0] == x ) return 1; if (s[0] == y ) return 0; exit(0); } int main() { int i, l, r; w... |
#include <bits/stdc++.h> using namespace std; struct Node { int idx, sum; int left, right; } tree[3000000]; int cnt; long long sumVal; char ch[10]; void addNode(int cur, int def, int h, int val) { if (tree[cur].idx == def) { tree[cur].sum += val; return; } tree[cur].sum += ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 105; const int mod = 998244353; const double Pi = acos(-1.0); const long long INF = 1e18; const int G = 3, Gi = 332748118; long long qpow(long long a, long long b) { long long res = 1; while (b) { if (b) res = (res * a) % mod;... |
/**
* 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; vector<int> out[1000]; int main() { int n; scanf( %d , &n); int ans; for (int i = 1; i * (i - 1) / 2 <= n; i++) { ans = i; } int id = 1; for (int i = 0; i < ans; i++) { for (int j = i + 1; j < ans; j++) { out[i].push_bac... |
#include <bits/stdc++.h> using namespace std; const int maxn = 10000 + 10; int a[maxn]; int main() { int i, j, k, m, n; cin >> n; int sum = 0; while (n > 0) { if (n % 8 == 1) sum++; n /= 8; } cout << sum << endl; return 0; } |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; double pi = acos((double)-1); const int MOD = 1000000007; const int INF = 2147483647; int main() { clock_t tStart = clock(); int tests = 1; for (int test = 1; test <= tests; test++) { int n, m, dx, dy;... |
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 27.11.2014 14:15:43
// Design Name:
// Module Name: red_pitaya_iq_fgen_block
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:... |
`define DEBOUNCE_VALUE 16'hf00f
module edge_detector (
iCLK,
iRST_n,
iTrigger_in,
oFalling_edge,
oRising_edge,
oDebounce_out,
rst_cnt
);
input iCLK;
input iRST_n;
input iTrigger_in;
output oFalling_edge;
output oRising_edge;
output reg oDebounce_out;
reg [1:0] in_delay_reg;
always@(posedg... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string rl; cin >> rl; vector<int> A(n, 0); for (int i = 0; i < n; i++) cin >> A[i]; int diff = 2147483647; int t; for (int i = 0; i < n - 1; i++) if (rl[i] == R && rl[i + 1] == L ) { t = ... |
#include<bits/stdc++.h> using namespace std; int cumsum[200005]; int a[200005]; int main() { int t; scanf( %d ,&t); while(t--) { int n; scanf( %d ,&n); for(int i=0;i<n;i++) { scanf( %d ,&a[i]); } for(int i=0;i<n;i++) { cumsum[i] = 0; } for(int i=0;i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, sum = 0; string x; cin >> n; for (int i = 1; i <= n; i++) { cin >> x; if (x == ABSINTH || x == BEER || x == BRANDY || x == CHAMPAGNE || x == GIN || x == RUM || x == SAKE || x == TEQUILA || ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 110, MAXK = 22, mod = 1000000007; struct edge { int adj, next; } e[MAXN << 1]; int n, k, f[MAXN][MAXK << 1]; int tot, head[MAXN], temp[MAXK << 1]; inline void AddEdge(int u, int v) { tot++; e[tot].adj = v, e[tot].next = head[u]; ... |
`timescale 1ns / 1ps
/*
-- Module Name: DES Sbox 6
-- Description: Sbox 6 del algoritmo DES
-- Dependencies: -- none
-- Parameters: -- none
-- Original Author: Héctor Cabrera
-- Current Author:
-- Notas:
-- History:
-- Creacion 05 de Junio 2015
*/
module des_sbox6
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Tecnológico de Costa Rica
// Engineer: Juan José Rojas Salazar
//
// Create Date: 30.07.2016 10:22:05
// Design Name:
// Module Name: shift_mux_array
// Project Name:
// Target Devices:
// Tool versio... |
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <vector> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <list> #include <casser... |
#include <bits/stdc++.h> using namespace std; using namespace std; vector<int> adj[100005]; vector<int>::iterator it; int con[100005]; bool visited[100005]; int bfs(int root) { int j, i, u, v, mn = 10000000, temp; queue<int> Q; Q.push(root); visited[root] = true; while (!Q.empty()) { ... |
#include <bits/stdc++.h> using namespace std; const int mo = 1e9 + 7; const int mx = 500010; int n, m, k, a[1010], c[1010], ans, sum; int jud[mx]; set<int> s[mx]; set<int>::iterator it; vector<int> vc[mx]; void dfs(int y, int pre) { vector<int> v; if (pre == -1) { int t = 1; for (i... |
/* Basic census transformation.
*
* Copyright (c) 2016, Stephen Longfield, stephenlongfield.com
*
* 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
... |
/**
* 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; long long global = 0; void test_case(long long); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; int yes = 1; if (yes) cin >> t; else t = 1; for (long long T = 0; T < t; T++) { test_case(T); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k = 0; string s; cin >> s >> n; vector<char> v, vv; int len = s.size(); if (len % n != 0) { cout << NO << endl; return 0; } int cnt = 0, c = 0, j; int m = len / n; for (int i = 0; i < n; 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 n, a[10]; int MOD = 1000000007; long long C[101][101]; void comb(int lim) { int n, r; C[0][0] = 1; for (n = 1; n <= lim; n++) { C[n][0] = 1; for (r = 1; r <= n - 1; r++) { C[n][r] = (C[n - 1][r - 1] + C[n - 1][r]) % MOD; }... |
#include <bits/stdc++.h> using namespace std; const long long int INF = 98769876987698889LL; const int MOD = 1e9 + 7; const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}; const int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1}; const int dx4[] = {1, -1, 0, 0}; const int dy4[] = {0, 0, 1, -1}; const int N = 2e5 + 5; l... |
#include <bits/stdc++.h> using namespace std; map<long long, long long> Map; void modify(long long x, long long y) { map<long long, long long>::iterator it; long long c; scanf( %I64d , &c); while (x != y) { if (x < y) swap(x, y); it = Map.find(x); if (it != Map.end()) it-... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> res, res2, res3; int x[10005], y[10005], id[35], b[35], vis[10005], r[10005]; bitset<35> c[35], d[35], tmp; int insert(int x, int y, bitset<35> now) { for (int i = 0; i <= 30; i++) if (x & (1 << i)) { if (!b[i]) { ... |
#include<bits/stdc++.h> #include<vector> #include<map> #include<queue> #define LL long long #define INF INT64_MAX #define MOD 1000000007 #define stree SegTree[root] #define lson SegTree[root << 1] #define rson SegTree[root << 1 | 1] using namespace std; const int N = 100005; LL a[N]; int main(... |
// $Id: c_prefix_arbiter.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, 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:
Redistribut... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long MAX_N = 1e6 + 5; using pii = pair<long long, long long>; struct edge { long long to, flow, cap, cost, rev; }; struct MinCostMaxFlow { long long nodes; vector<long long> prio, curflow, prevedge, prevnod... |
// Copyright 2018 Google LLC
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... |
#include <bits/stdc++.h> using namespace std; namespace Flandle_Scarlet { int n; int a[51][51]; char tmp[51]; int s[51][51]; void Input() { cin >> n; for (int i = 1; i <= n; ++i) { scanf( %s , tmp); for (int j = 1; j <= n; ++j) { if (tmp[j - 1] == # ) a[i][j] = 1; ... |
#include <bits/stdc++.h> using namespace std; int n; int C[1 << 12], A[1 << 12], B[1 << 12], LA[1 << 12], LB[1 << 12]; int main() { int i, s = 0; scanf( %d , &n); n = (1 << n); for (i = 0; i < n; i++) { scanf( %d , &C[i]); s ^= C[i]; } if (s) { puts( Fou ); return... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; int n, b; string a, c; int main() { cin >> n; int l = -2e9, r = 2e9; for (; n--;) { cin >> a >> b >> c; if (a == > && c == Y || a == <= && c == N ) l = max(l, b + 1); else if (a == >= && c == Y || a == < && c == 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... |
module buffer2axis #(
parameter DWIDTH = 32,
parameter WIDTH = 4,
parameter HEIGHT = 4
)(
// Control signals
clk,
rstn,
// Color conversion signals
alive_color,
dead_color,
// AXIS Connection
M_AXIS_TDATA,
M_AXIS_TVALID,
M_AXIS_TREADY,
M_AX... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); int ans = 0; for (int i = 1; i <= k; i++) ans += a[i]; cout << ans; return 0; } |
#include <bits/stdc++.h> using namespace std; int t; long long l, r; inline void solve() { cin >> t; while (t--) { cin >> l >> r; long long ans = l; for (int i = 0; i <= 62; ++i) { if (ans + (1ll << i) <= r && (ans & (1ll << i)) == 0) { ans += (1ll << i); } ... |
`define SNIFFER 3'b000
`define TAGSIM_LISTEN 3'b001
`define TAGSIM_MOD 3'b010
`define READER_LISTEN 3'b011
`define READER_MOD 3'b100
`define FAKE_READER 3'b101
`define FAKE_TAG 3'b110
`include "relay_mode.v"
`include "relay_decode.v"
`include "relay_encode.v"
module relay (
clk,
reset,
data_in,
hi_simulate_... |
module Datapath(
clock,
reset,
instrucao,
outALU,
);
input clock, reset;
output reg [31:0] outALU, instrucao;
always @ (*) begin
instrucao = instruction;
outALU = aluOut;
end
wire [31:0] instruction, outPC, outDataMemory, ioOut, mux2Out, muxRegisterBankOut, data;
wire signed [31:0] rsValue, rtVal... |
// 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 = 4,
parameter dat_width = 8
)
(
input clk, reset,
input rd, wr,
input [dat_width-1:0] data_in,
output... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long s = 0, w = 1; register char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar... |
/*
* File: lsu_reg2mem.v
* Project: pippo
* Designer: fang@ali
* Mainteiner: fang@ali
* Checker:
* Description: MUX for store data
* Task: [TBD] comment out unneccessary access pattern(same with default), to evaluate syn result
*/
// synopsys translate_off
`include "timescale.v"
// synops... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
//
// Test register module for RCN Bus
// 0x00 : Bus ID
// 0x04 : Test Progress Mark
// 0x08 : Test Fail
// 0x0C : Test Pass
//
module rcn_testregs
(
input clk,
input rst,
input [68:0] rcn_in,
ou... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
mod... |
#include <bits/stdc++.h> using namespace std; void print_err() { cerr << n ; } template <class T, class... Arg> void print_err(T x, Arg &&...args) { cerr << x << ; print_err(args...); } template <class T> void print_container(T &cont) { for (auto iter : cont) { cerr << iter << ; ... |
#include <bits/stdc++.h> using namespace std; int H, M, S, X, Y; bool A, B; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> H >> M >> S >> X >> Y; A = 1; B = 1; H = H % 12; if (X > Y) { swap(X, Y); } if (S > 5 * X && S < 5 * Y) { B =... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); long long int t; cin >> t; while (t--) { long long int n; cin >> n; vector<long long int> a(n); vector<long long int> b(n); for (long long i... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> arr; int dp[101][101][101][2]; int solve(int index, int even, int odd, int pre) { if (index == n + 1) return 0; if (dp[index][even][odd][pre] != -1) return dp[index][even][odd][pre]; if (arr[index] != 0) { int ans = solve(index... |
// (C) 2001-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 doc... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: pizza.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 la... |
`timescale 1ns/10ps
module vga_pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'outclk1'
output wire outclk_1,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_v... |
// synopsys translate_off
`timescale 1 ns / 1 ns
// synopsys translate_on
module altera_jtag_sld_node (
ir_out,
tdo,
ir_in,
tck,
tdi,
virtual_state_cdr,
virtual_state_cir,
virtual_state_e1dr,
virtual_state_e2dr,
virtual_state_pdr,
virtual_state_sdr,
virtual... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; string ans; long cnt = 0; for (long i = 0; i < s.size(); i++) { if (s[i] == t[i]) ans += 1 ; else { if (cnt % 2) ans += s[i]; else ans += t[i]; ... |
// ==============================================================
// RTL 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
modul... |
#include <bits/stdc++.h> using namespace std; int table[20][20]; int A[20] = {0, 0, 4, 6, 8, 9, 11, 13, 15, 17}; int a[20][20]; int first_x, last_x, first_y, last_y; int n, m; int ans = 0, cur = 0; void solve(int x, int y) { if (x > last_x) { if (cur > ans) { ans = cur; for (in... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a; b = a - 1; c = a - 2; if (a >= 3) { if (b % 2 != 0) { if (a % 3 == 0) { long long e = a * b * c / 2; long long r = a * b * (c - 1) / 3; long long t = a * b * (c - 2... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k, p, i, j, max = 0; cin >> n >> k >> p; long long a[n + 1]; long long b[k + 1]; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= k; i++)... |
#include <bits/stdc++.h> using namespace std; const int N = 110000; int x[N], y[N]; vector<int> vec[2]; int main() { int n; scanf( %d , &n); auto prv = [&n](int x) { return (x - 1 + n) % n; }; auto nxt = [&n](int x) { return (x + 1) % n; }; for (int i = 0; i < n; i++) scanf( %d%d , &x[i], ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; char s[maxn], t[maxn]; int pr, mod; const int prs[60] = { 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 24... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, c; cin >> n >> k >> c; int p = ((n * k * c) / 100); int k1 = p / k; int k2 = p % k; for (int i = 0; i < n; i++) { if (i != 0) cout << ; if (i < k1) cout << k; else if (i == k1) cout << k... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e9 + 8; const long double pi = 3.14159265359; template <class T> T fac(T n) { T res = 1, i; for (i = 2; i <= n; i++) res *= i; return res; } template <class T> T lcm(T a, T b) { return (... |
#include <bits/stdc++.h> using namespace std; long long f[1000001][4][2]; string s; signed main() { cin >> s; for (long long lst = 0; lst < 4; lst++) f[s.length()][lst][0] = f[s.length()][lst][1] = 0; f[s.length()][0][0] = f[s.length()][1][0] = f[s.length()][3][0] = 1; for (long long i = s... |
`default_nettype none
`timescale 1ns / 1ps
`include "xrs.vh"
//
// Signal Descriptions
// ===================
//
// clk_i Processor clock (also Wishbone's clock).
// reset_i 1 to reset the circuit in the next cycle.
// 0 for normal operation.
//
// Inputs from execute stage:
//
// xrs_rd_i Destination register to wr... |
//==================================================================================================
// Filename : subRecursiveKOA_1c.v
// Created On : 2016-10-27 23:29:04
// Last Modified : 2016-10-28 08:14:58
// Revision :
// Author : Jorge Esteban Sequeira Rojas
// Company : Institut... |
module maquina_TB;
integer a;
wire ledVerde, ledVermelho;
wire [6:0] HEX;
reg [4:0] val;
reg clock;
inicial i( a[4], a[3], a[2], a[1], a[0], ledVerde, ledVermelho, HEX, clock);
//Alterando clock
always begin
clock <= 0;
#25;
clock <= 1;
#25;
end
initial begin
$dis... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Module Name: boolean_lut
// Project Name: PYNQ_Interface
// Target Devices: Z7020
// Description: This module allows up to 5 variables function to be reconfigured
// dynamically. The reconfiguration t... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
// local paramaters used as defines
parameter TIME_START = 1'b0;
parameter TIME_CHECK = 1'b1;
reg [31:0] i;
reg r_state;
`ifdef OVL_XCHECK_OFF
//Do nothing
`else
`ifdef OVL_IMPLICIT_XC... |
#include<bits/stdc++.h> #define ll long long using namespace std; ll t1,n,a[500010],mn[500010][2],f[2],sum[2],z[2]; int main(){ ll i,j,op,flag; scanf( %lld ,&t1); while(t1--){ scanf( %lld ,&n); for(i=1;i<=n;i++)scanf( %lld ,&a[i]); mn[n+1][0]=mn[n+1][1]=1e18; for(i=n;i;i--){ mn[i][... |
module m;
bit [0:0] a, b, c;
covergroup g;
cp_ab: coverpoint {a,b} {
bins one = {1};
bins two = {2};
}
cp_ab_if_c: coverpoint {a,b} iff c {
bins one = {1};
bins two = {2};
... |
/**
* 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 eps = 1e-8; const double PI = acos(-1.0); int a[100005], s[100005], dp1[100005], dp2[100005], b[100005], ans[100005]; int main() { int n, i, maxlen, k; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]), b[n - i + 1] = -a[i]; ... |
module modexp_2N_NN
#(
parameter N = 8, //number of bits
parameter CC = 2*N*N //2*N to 2*N*N
)
(
clk,
rst,
g_init, // {m}
e_init, // {e, n}
o // o = m^e mode n
);
input clk;
input rst;
input [N-1:0] g_init;
input [2*N-1:0] e_init;
output [N-1:0] o;
reg first_... |
#include <bits/stdc++.h> using namespace std; int f[35][1005][5]; void preprocess() { int i, j, k, l; for (i = 0; i <= 1000; i++) f[0][i][0] = f[0][i][1] = f[0][i][2] = f[0][i][3] = 0; i = 0; f[0][i][0] = f[0][i][1] = f[0][i][2] = f[0][i][3] = 1; for (i = 1; i < 31; i++) { f[i][0][... |
#include <bits/stdc++.h> using namespace std; map<int, int> cnt1, cnt2; const int maxn = 1e5 * 3; int x[maxn]; int y[maxn]; int main() { int n = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; cnt1[x[i] - y[i]]++; cnt2[x[i] + y[i]]++; } long long ans = 0... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 50; const long long oo = 1e9; const long long mod = 998244353; long long dp[2][510][510], cnt[501], p[501]; int main() { int n, k; scanf( %d%d , &n, &k); dp[0][0][0] = 1; for (int i = 0; i < n; i++) { int q = i % 2; ... |
#include <bits/stdc++.h> using namespace std; int n; int t[60], v[60]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &t[i]); for (int i = 1; i <= n; i++) scanf( %d , &v[i]); int nrOfStonesTakenAway = 0; for (int i = 1; i <= n; i++) { if (t[i] > v[i]) nrOfStones... |
#include <bits/stdc++.h> using namespace std; long long int invmod(long long int x, long long int n, long long int mod) { if (n == 0) return 1 % mod; long long int half = invmod(x, n / 2, mod); half = (half * half) % mod; if (n % 2 == 1) half = (half * (x % mod)) % mod; return half; } long l... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long n, l, v1, v2, k; int main() { cin >> n >> l >> v1 >> v2 >> k; long long g = (n + k - 1) / k; double le = 0, ri = l / (double)v1; while ((ri - le) >= 5e-7) { double mid = (le + ri) / 2; double t = 0; for (int i = 1; i <= g; i... |
#include <bits/stdc++.h> using namespace std; using ll = long long; void dump(const vector<int>& a) { for (int i = 0; i < a.size(); i++) { cerr << a[i] << ; } cerr << endl; } vector<pair<int, int>> factorise(long long m) { vector<pair<int, int>> res; for (long long i = 2; i * 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... |
// file: clk_wiz_0.v
//
// (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
// laws.
//
// DISCLAIMER
// This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; int arr[102][102] = {0}; int main() { int n, m, a, b, sum = -1, minsum = -1; scanf( %d%d , &n, &m); int cost[n + 1]; for (int i = 1; i <= n; i++) { scanf( %d , &cost[i]); } for (int i = 1; i <= m; i++) { scanf( %d%d , &a, &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 law... |
#include <bits/stdc++.h> using namespace std; const long long int infinity = 9e18; bool possible(long long int x1, long long int x2, long long int y1, long long int y2, long long int n, long long int m, string s, long long int dx, long long int dy) { long long int a = m / n; ... |
#include <bits/stdc++.h> using namespace std; const int N = 100050; struct str { int pre[26], suf[26], mx[26], len; str() {} void Build(char s[], int n) { len = n; for (int i = 0; i < 26; i++) pre[i] = suf[i] = mx[i] = 0; int len = 0; for (int i = 1; i <= n; i++) { 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; const int MAXN = 15e4 + 4; const int MAXQ = MAXN; const int MAXK = 6 + 2; int n, k, q; int t[MAXN]; set<int, greater<int> > st; int main() { scanf( %d%d%d , &n, &k, &q); for (int i = 0; i < n; ++i) scanf( %d , t + i); while (q--) { int op, ... |
#include <bits/stdc++.h> using namespace std; int main() { double n, m; scanf( %lf %lf , &n, &m); printf( %.6lf , pow(1.000000011, m) * n); } |
// Check assignment operations in constant functions.
module constfunc7();
function real i_to_r(input signed [3:0] value);
i_to_r = value + 0.5;
endfunction
function signed [3:0] r_to_i(input real value);
r_to_i = value;
endfunction
function real u_to_r(input [3:0] value);
u_to_r = value + 0.5;
endfunction
fu... |
module j1soc#(
//parameter bootram_file = "../../firmware/hello_world/j1.mem" // For synthesis
parameter bootram_file = "../firmware/Hello_World/j1.mem" // For simulation
)
(uart_tx, ledout,
sys_clk_i, sys_rst_i,ledres,micLRSel,trigg,echo);
... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > a[100010]; vector<int> ans; string s, s1, s2; int n, m; int v, e, p, q; int main() { cin >> n; if (n == 2) { cout << 0; return 0; } int ans = n / 2 - 1; if (n % 2) ans++; cout << ans; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.