text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MaxN = 110; const double EPS = 1E-10; struct TTriangle { double x[3], y[3]; } a[MaxN]; struct TSeg { double x[2], y[2]; } Seg[MaxN * 3]; int n, Total; double Ans; pair<double, int> s[MaxN * 3 * 2]; inline double Cross(const double x1,... |
/**
* 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) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
module automatic_events();
reg [5:1] any;
integer k;
initial begin
any = 5'b00000;
#200;
for (k = 1; k <= 5; k = k + 1) begin
#10 any[k] = 1;
#10 any[k] = 0;
end
end
task automatic report_events;
input integer n;
begin:task_body
reg [5:1] pos;
reg [5:1] neg;
#n;
pos = 5'b00000;
neg = 5'... |
module reg_128x32b_3r_2w_fpga
(/*AUTOARG*/
// Outputs
rd0_data, rd1_data, rd2_data,
// Inputs
clk, rd0_addr, rd1_addr, rd2_addr, wr0_addr, wr1_addr, wr0_en,
wr1_en, wr0_data, wr1_data
,clk_double
);
input clk;
input clk_double;
output [31:0] rd0_data;
output [31:0] rd1_data;
output [31:0] rd2_data... |
module top(...);
input [3:0] a;
output o1_1 = 4'b0000 > a;
output o1_2 = 4'b0000 <= a;
output o1_3 = 4'b1111 < a;
output o1_4 = 4'b1111 >= a;
output o1_5 = a < 4'b0000;
output o1_6 = a >= 4'b0000;
output o1_7 = a > 4'b1111;
output o1_8 = a <= 4'b1111;
output o2_1 = 4'sb0000 > $signed(a);
ou... |
/**
* 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 = 755, M = 10000005; char s[M]; bool e[N][N]; int n; struct ACAutomaton { int trie[M][2], id[M], idx, pos[M], fa[M]; void ins(char *s, int t) { int cur = 0, l = strlen(s + 1); for (int i = 1; i <= l; i++) { if (!trie[cur][... |
module hdUnit(
d_raddr1, d_raddr2, d_addrselector, d_jr_or_exec, d_immonly, d_opcode, e_isLoad, e_wreg,
//nop_alu_stall, nop_lw_stall, nop_sw_stall, // this doesn't seem to be required for this
pc_stall, ifid_stall, idex_stall, inst_stall,
write_done
);
// d_addrselector is lhb_llb_regcon, it gives addr fof [... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: sfifo_31x128.v
// Megafunction Name(s):
// scfifo
// ============================================================
// *******************... |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { cin >> n >> m; if (n == 1) { cout << 1; exit(0); } cout << fixed << setprecision(12) << 1.0 / n + (1.0 * (n - 1)) / n * (1.0 * (m - 1)) / (m * n - 1); } |
//
// tmr.v -- programmable timer
//
module tmr(clk, reset,
en, wr, addr,
data_in, data_out,
wt, irq);
input clk;
input reset;
input en;
input wr;
input [3:2] addr;
input [31:0] data_in;
output reg [31:0] data_out;
output wt;
output irq;
reg [31:... |
/*
* 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... |
module core (
ir_next,
ir_be,
// ir0, ir1,
// ir11, ir10, ir01, ir00,
// ir111, ir110, ir101, ir100, ir011, ir010, ir001, ir000,
// ir1111, ir1110, ir1101, ir1100, ir1011, ir1010, ir1001, ir1000, ir0111, ir0110, ir0101, ir0100, ir0011, ir0010, ir0001, ir0000,
of_r1101, of_r1100, of_r1011, of... |
/*
Copyright (c) 2014 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,... |
`timescale 1ns / 1ps
module Microphone(
output spi_clk, // SPI clock to ADC
output spi_mosi, // Data to ADC
output reg spi_cs, // Chip select for ADC
input spi_miso, // Data from ADC
input clk,
input rst,
input start_sample, // Set to 1 to sample the ADC
output reg sample_done, // Latest sample is... |
#include <bits/stdc++.h> using namespace std; const int N = 205; const int mod = 10007; void add(int &x, int y) { x += y; if (x >= mod) x -= mod; } int mul(int x, int y) { return x * y % mod; } int pw(int x, int y) { int ret = 1; while (y) { if (y & 1) ret = mul(ret, x); x = mu... |
#include <bits/stdc++.h> using namespace std; int main() { int k, d; cin >> k >> d; if (k > 1 && d == 0) cout << No solution ; else { cout << d; for (int i = 0; i < k - 1; i++) cout << 0 ; } return 0; } |
`timescale 1ns/10ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be:... |
/**
* 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; const long long mod = 1e9 + 7; void _IOS() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); } long long a[500009], b[500009]; long long n, m, k; map<long long, bool> pg; long long dp[100009][3]; int main() { _... |
#include <bits/stdc++.h> using namespace std; struct node { int v; long long w; node(){}; node(int v, long long w) : v(v), w(w) {} }; vector<vector<node> > G; int b[102550]; long long solve(int s) { long long ans = 10000000000000000; int len = G[s].size(); for (int i = 0; i < len... |
// (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 any of the foregoing (including device programming or simulation
// files), and any associated docum... |
#include <bits/stdc++.h> using namespace std; int qtable[9][9]; int x_min[9]; int x_max[9]; int y_min[9]; int y_max[9]; int solve_problem() { int n, m, k, s; if (scanf( %d %d %d %d , &n, &m, &k, &s) != 4) return 1; fill(x_min, x_min + k, numeric_limits<int>::max()); fill(x_max, x_max + k, ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, a1, a2, b1, b2, c1, c2, s; cin >> n; cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2; s = a1 + b1 + c1; n = n - s; if (n == 0) { cout << a1 << << b1 << << c1 << endl; return 0; } else { a2 = a2 ... |
#include <bits/stdc++.h> void sort(int *a, int n) { int isSorted = 0; int i; int tmp; while (isSorted == 0) { isSorted = 1; for (i = 0; i < n - 1; i++) { if (a[i] > a[i + 1]) { tmp = a[i]; a[i] = a[i + 1]; a[i + 1] = tmp; isSorted = 0; ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<int, int> > v[1000007]; vector<int> rv[1000007]; int comp[1000007]; vector<pair<int, int> > g[1000007]; long long sm[1000007]; int used[1000007]; int stver; stack<int> s; vector<int> srt; bool val[100000002]; long long hval[10... |
#include <bits/stdc++.h> int main() { int n, x; std::cin >> n >> x; std::vector<int> data; int counter = 0; for (int i = 0; i != n; i++) { int temp; std::cin >> temp; data.push_back(temp); } std::sort(data.begin(), data.end()); if (std::find(data.begin(), data.end(), ... |
/*===========================================================================*/
/* Copyright (C) 2001 Authors */
/* */
/* This source file may be used and distributed without restriction provided */
... |
//=========================================================
// Integrated Instruction/Data memory (seperate ports)
//=========================================================
`define EOF 32'hFFFF_FFFF
`define NULL 0
`timescale 1ns/100ps
module Memory(
inst_addr,
instr,
data_addr,
data_in,
mem_read,
mem_wri... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T sqr(const T &a) { return a * a; } template <typename T> inline int nread(vector<T> &a) { int n; cin >> n; a.clear(); a.resize(n); for (int i = 0; i < n; i++) cin >> a[i]; return n; } template <typena... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: sfifo_7x16_la.v
// Megafunction Name(s):
// scfifo
//
// 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... |
/*
Copyright (C) 2016
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 writing, software
distribute... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 12; int rows, cols, k, n; char mat[MAXN][MAXN]; int sol = 0; int Calc(int a, int b, int c, int d) { int ret = 0; for (int i = a; i <= c; i++) { for (int j = b; j <= d; j++) ret += (mat[i][j] == # ); } return ret; } int... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(false); int n; cin >> n; int pass = 0, ans = 0; while (n) { ans += n; ans += (pass * (n - 1)); pass++; --n; } cout << ans; return 0; } |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:26:40 08/18/2012
// Design Name: timing_synch_fsm
// Module Name: /home/glenn/Documents/Firmware/FONT5_base/ISE10/FONT5_base/timing_sync_fsm_tb.v
// Project Name: ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n, sum = 0, maxi, mini, start, end; ; cin >> a >> b >> n; mini = min(a, b); maxi = max(a, b); if (n <= min(a, b)) { cout << n + 1; } else { if (mini + maxi >= n) { int k = n - maxi; if (k < 0... |
#include <bits/stdc++.h> using namespace std; const long long N = 100010; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long n, m, p, a[N], b[N], q[N], yue[N], miu[N], f[N], tot; long long ans; long long power(long long a, long long b, long long m) { long long re = 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 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... |
#include <bits/stdc++.h> #pragma GCC optimize( unroll-loops ) using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 40500; int h, lgn, n, t, r, x, y, a[N], dis[N], lp[N], dp[N][17]; vector<pair<int, int> > e1, e2; vector<int> g[N]; bool mark[N]; int lg... |
#include <bits/stdc++.h> using namespace std; int n, m; long long int arr[100050]; vector<vector<long long int>> v(100050); int main() { cin >> n >> m; for (int i = 1; i <= m; i++) cin >> arr[i]; for (int i = 1; i <= m; i++) { if (i > 1 && arr[i - 1] != arr[i]) v[arr[i]].push_back(arr[i - 1]... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int m; int count; int sum; while (scanf( %d%d , &n, &m) != EOF) { count = 0; sum = 0; if (n == m) { printf( 0 ); printf( n ); continue; } while (n < m) { n = n * 2; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000100; const int INF = (1 << 29); const double EPS = 0.000000001; const double Pi = acos(-1.0); int n; long long x[maxn]; int main() { while (cin >> n) { for (int i = 1; i <= n; i++) scanf( %I64d , &x[i]); sort(x + 1, x + n... |
#include <bits/stdc++.h> int getmin(int a, int b) { if (a == -1) return b; else if (b == -1) return a; else return a < b ? a : b; } int solve(int a, int b) { int tot = 0; while (a != 1 || b != 1) { tot++; if (!a || !b) return -1; if (a > b) 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; int compare(const void* a, const void* b) { return ((*(pair<long long, long long>*)a).first - (*(pair<long long, long long>*)b).first); } string alfabet = abcdefghijklmnopqrstuvwxyz ; int main() { long long n, x1, x2, k, b; cin >> n; c... |
#include <bits/stdc++.h> using namespace std; int a[110], b[110], n; int main() { int t; cin >> t; while (t--) { cin >> n; for (register int i = 1; i <= n; i++) cin >> a[i]; for (register int i = 1; i <= n; i++) cin >> b[i]; sort(a + 1, a + n + 1); sort(b + 1, b + 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for (int i = s.size() - 1; i >= 0; i--) { int x = s[i] - 0 ; if (x >= 5) printf( -O| ); else printf( O-| ); x = x % 5; if (x == 0) printf( -OOOO n ); else if (x == ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6; long long int x[maxn]; long long int sum, ans; map<long long int, long long int> table[27]; string s; int main() { for (int i = 1; i <= 26; i++) cin >> x[i]; cin >> s; for (int i = 0; i < s.size(); i++) { ans += table[s[... |
#include <bits/stdc++.h> using namespace std; int power(int num1, int num2) { int ans = 1; for (int i = 0; i < num2; i++) { ans *= num1; } return ans; } int main() { string str; int num1, help = 0; cin >> num1 >> str; for (int i = 0; i < str.size(); i++) { help += pow... |
#include <bits/stdc++.h> using namespace std; const int mx = 200100; struct node { int x, y, z; } a[mx]; struct nod { int id, x; } b[mx]; int fa[mx]; long long num[mx]; long long ans[mx]; int n, m; bool cmp(node x, node y) { return x.z < y.z; } bool cmp1(nod x, nod y) { return x.x < y.x;... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int t = 1; while (t--) { int n; cin >> n; map<int, vector<int>> m; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; m[v[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... |
// avm.v
//
// AVM in Verilog
//
// This is an implementation of AVM in C for experimenation purposes.
// It is both an AVM interpretr and an assembler for the instruction set.
//
// (C) 2016 David J. Goehrig
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modifica... |
/**
* 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> template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); } using namespace std; int main() { cin.tie(NULL), ios_base::sync_with_stdio(false); int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a > b) { if ((b - a) % 2 =... |
// See bug75
module autoinst_interface
(/*AUTOINOUTMODULE("autoinst_interface_sub")*/
// Beginning of automatic in/out/inouts (from specific module)
output logic [7:0] count,
input logic clk,
input logic reset,
input logic start,
my_svi.master my_svi_port,
my_svi my_svi_nopo... |
/**
* 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 "bsg_defines.v"
module bsg_wormhole_router_output_control
#(parameter `BSG_INV_PARAM(input_dirs_p))
(input clk_i
, input reset_i
// this input channel has a header packet at the head of the FIFO for this output
, input [input_dirs_p-1:0] reqs_i
// the input channel finished a packet on... |
#include <bits/stdc++.h> using namespace std; char a[514][514]; int n, m; int ID[514][514]; int RID[20005]; int idt[20005]; int g[20005]; int FIND(int x) { return g[x] == x ? x : (g[x] = FIND(g[x])); } void UNION(int x, int y) { x = FIND(x); y = FIND(y); g[x] = y; } int edge(int x, int... |
//*****************************************************************************
// (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
/... |
module Pipeline_tb ();
reg clk, rst_n, rx;
reg [7:0] switch;
wire tx;
wire [7:0] led;
wire [6:0] digi[3:0];
CPU cpu(
.clk(clk), .rst_n(rst_n),
.switch(switch),
.led(led),
.rx(rx), .tx(tx),
.digi_out1(digi[0]),
.digi_out2(digi[1]),
.digi_... |
// MBT 11/9/2014
//
// Synchronous 1-port ram.
// Only one read or one write may be done per cycle.
`define bsg_mem_1rw_sync_macro_bit(words,bits,lgEls,mux) \
if (els_p == words && width_p == bits) \
begin: macro \
tsmc40_1rw_lg``lgEls``_w``bits``_m``mu... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE AC 97 Controller ////
//// DMA Request Module ////
//// ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; cin.get(); vector<string> v(n); for (int i = 0; i < n; i++) getline(cin, v[i]); vector<int> p(k); for (int i = 0; i < k; i++) p[i] = i; int minDiff = INT_MAX; do { int minNum, maxNum; ... |
#include <bits/stdc++.h> using namespace std; int n, x; bool X[26]; int mat[6][6]; int niz[26]; int sum; bool check() { sum = 0; for (int i = 0; i < n; i++) sum += mat[i][0]; for (int j = 1; j < n; j++) { int st = 0; for (int i = 0; i < n; i++) st += mat[i][j]; if (st != sum)... |
// (C) 2001-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 simulation
// files), and any associated doc... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_33x256.v
// Megafunction Name(s):
// scfifo
//
// 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... |
#include <bits/stdc++.h> using namespace std; const int N = 605; int n; vector<int> g[N]; map<vector<int>, int> memo; int ask(vector<int> &vs) { if (int((vs).size()) <= 1) return 0; sort((vs).begin(), (vs).end()); if (memo.count(vs)) return memo[vs]; cout << ? << int((vs).size()) << endl;... |
// (c) Copyright 1995-2017 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 ... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; const long long N = 1000 + 5, L = 12, inf = LLONG_MAX; long long n, m, k; long long a[N][N], par[N * N], sz[N * N], res[N][N], hh, cnt; bool mark[N][N], vis[N][N]; long long mp[N * N]; vect... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long int n, m, a; cin >> n >> m >> a; long int colNum = ceil((double)a / (double)(2 * m)); a -= (colNum - 1) * m * 2; long int rowNum = ceil((double)a / 2); ... |
#include <bits/stdc++.h> using namespace std; int N, K = 0; int ans[1005]; int main() { scanf( %d , &N); int i, j, tmp = 0; for (i = 1; i * 2 < N; i++) { ++K; ans[K] = i; N -= i; } printf( %d n , K + 1); for (i = 1; i <= K; i++) printf( %d , ans[i]); printf( %d n ,... |
#include <bits/stdc++.h> using namespace std; int main() { int i, c = 0, j, x = 0, n; cin >> n; string s; vector<string> ar; for (i = 0; i < n; i++) { cin >> s; ar.push_back(s); } for (i = 0; i < ar[0].length(); i++) { for (j = 0; j < n - 1; j++) { if (ar[j][i] ... |
`default_nettype none
`timescale 1ns / 1ps
module cls_spi(
input wire clock,
input wire reset,
input wire [15:0] A,
input wire [7:0] Di,
input wire [7:0] Do,
input wire [15:0] PC,
input wire [15:0] SP,
input wire [15:0] AF,
input wire [15:0] BC,
input wire [15:0] DE,
input wire... |
/**
* 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 inputconditioner(clk, noisysignal, conditioned, positiveedge, negativeedge);
output reg conditioned = 0;
output reg positiveedge = 0;
output reg negativeedge = 0;
input clk, noisysignal;
// variables
parameter counterwidth = 5;
parameter waittime = 10;
reg[counterwidth-1:0] counter = 0;
reg sync0 = 0;
reg sync... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:56:33 05/24/2015
// Design Name:
// Module Name: subroutine_stack
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
/... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:34:12 11/19/2013
// Design Name: top_module
// Module Name: C:/Users/Fabian/Desktop/Respaldo taller/taller-diseno-digital-master/Proyecto Final/tec-drums/top_modul... |
// Library - static, Cell - th44w22, View - schematic
// LAST TIME SAVED: May 23 17:59:39 2014
// NETLIST TIME: May 23 17:59:46 2014
`timescale 1ns / 1ns
module th44w22 ( y, a, b, c, d );
output y;
input a, b, c, d;
specify
specparam CDS_LIBNAME = "static";
specparam CDS_CELLNAME = "th44w22";
spec... |
/**
* 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, cntx = 0, cntX = 0, c = 0; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == x ) cntx++; else cntX++; } int i = 0; if (cntx > cntX) { while (cntx != cntX) { ... |
/*
Copyright (c) 2015-2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
module fifo(in_data, in_d_rdy, clk, out_data, out_d_rdy, rdy2rcv);
parameter WIDTH=8;
parameter BUFF_LEN=16;
parameter BUFF_LENm=BUFF_LEN - 1;
parameter BUFF_LEN_WIDTH_bits = (BUFF_LENm[7:7]==1'b1) ? 8 :
(BUFF_LENm[6:6]==1'b1) ? 7 :
(BUFF_LENm[5:5]==1'b1) ? 6 :
(BUFF_LENm[4:4]==1'b1)... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:47:13 03/17/2015
// Design Name:
// Module Name: or_gate
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
/**
* 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; map<string, int> fr; int main() { ios_base::sync_with_stdio(false); string s; cin >> s; for (int k = 0; k <= 9; k++) { string a; cin >> a; fr[a] = k; } int id = 0; string act = ; for (int k = 0; k < 80; k++) { ... |
module tx_frontend
#(parameter BASE=0,
parameter WIDTH_OUT=16,
parameter IQCOMP_EN=1)
(input clk, input rst,
input set_stb, input [7:0] set_addr, input [31:0] set_data,
input [23:0] tx_i, input [23:0] tx_q, input run,
output reg [WIDTH_OUT-1:0] dac_a, output reg [WIDTH_OUT-1:0] dac_b
);
... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_XCHECK_OFF
//Do nothing
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
//Do nothing
`else
wire valid_test_expr;
wire valid_start_state;
wire valid_next_state;
assign valid_test_ex... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; struct node { int x, y, id; void scan() { scanf( %d%d , &x, &y); if (x > y) swap(x, y); } } e[N * 5], q[N], tmp[N]; struct opt { int x, y, sz, f; long long ans; } op[N * 5]; int T; int ext; int cnt, n... |
module test();
localparam [7:0] dly1 = 1;
wire [7:0] dly2 = 2;
reg [7:0] dly3 = 3;
reg en;
wire i = 1;
wire [6:1] o;
tranif1 #(dly1, dly2) buf1(o[1], i, en);
tranif1 #(dly2, dly1) buf2(o[2], i, en);
tranif1 #(dly1, dly3) buf3(o[3], i, en);
tranif1 #(dly3, dly1) buf4(o[4], i, en);
tr... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 110; const int INF = 1 << 28; const double EPS = 1e-9; const double PI = 3.14159265358979; int n, d; int a[MAX_N]; int x[MAX_N], y[MAX_N]; int g[MAX_N][MAX_N]; int main() { cin >> n >> d; for (int i = (1); i < (n - 1); i++) cin ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; char arr[105]; scanf( %d%*c , &t); while (t--) { gets(arr); int len = strlen(arr); char temp[20] = {arr[len - 5], arr[len - 4], arr[len - 3], arr[len - 2], arr[len - 1]}; char tem[20] = {... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.