text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; string s; int n, x, y; void upd(pair<int, int> &pos, char mv, int d) { switch (mv) { case U : pos.second += d; break; case D : pos.second -= d; break; case L : pos.first -= d; break; case...
/* * 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 INF = (1LL << 30) - 1; const long long int LINF = (1LL << 62) - 1; const int NMAX = (1e5) + 5; int N, M; int pile[NMAX]; bool check(long long int time) { int i, k; long long int curr; int P[NMAX]; memcpy(P, pile, sizeof(pile)); fo...
#include <bits/stdc++.h> using namespace std; void fast(); int main() { fast(); int n, cookies[105] = {0}; cin >> n; int sum = 0; for (int i = 0; i < n; ++i) { cin >> cookies[i]; sum += cookies[i]; } int cnt = 0; for (int i = 0; i < n; ++i) { int cook = sum; ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 200005; struct node { long long ab; long long cab; } a[maxn], b[maxn]; struct mon { long long x, y, z; } mo[maxn]; bool cmpab(struct node ab1, struct node ab2) { return ab1.ab < ab2.ab; } bool cmpm(struct mon mo1, struct mo...
#include <bits/stdc++.h> using namespace std; char a; int r, c; bool side(int x) { if (x == 1 or x == 8) return true; return false; } int type(int x, int y) { if (side(x) and side(y)) return 1; if (side(x) or side(y)) return 2; return 3; } int main() { scanf( %c%d , &a, &r); ...
#include <bits/stdc++.h> using namespace std; #define int long long int void next(char &x){ if(x<= b ){ x++; }else{ x= a ; } } void solve() { int n,k; cin>>n>>k; char cur= a ; for(int i=0;i<n;i++){ cout<<cur; next(cur); } ...
`default_nettype none `define WIDTH 16 module j1( input wire clk, input wire resetq, output wire io_rd, output wire io_wr, output wire [15:0] mem_addr, output wire mem_wr, output wire [`WIDTH-1:0] dout, input wire [`WIDTH-1:0] io_din, output wire [12:0] code_addr, input wire [15:0] insn); r...
// megafunction wizard: %ALTDDIO_OUT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altddio_out // ============================================================ // File Name: ddio_out.v // Megafunction Name(s): // altddio_out // // Simulation Library Files(s): // altera_mf // =================...
#include <bits/stdc++.h> using namespace std; char opt; long long a, b, c, ansa, ansb, ansc, anslen = 15; void dfs(long long a, long long b, long long c, long long nowa, long long nowb, int pre, long long len, long long step) { if (len >= anslen) return; if (!a && !b && !c && !pre) { an...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 200000; struct el { int l, r, id; } a[MAX_N], b[MAX_N]; long k[MAX_N]; class compare { public: bool operator()(el a, el b) { return a.r < b.r; } }; int main() { int n, m; cin >> n; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, a, b, x, y, flag = 0; cin >> n >> a >> x >> b >> y; int in = 0; for (int i = 0; i < n; i++) { a = a % n + 1; b = b - 1; if (b == 0) b = n; if (a == b) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; r...
#include <bits/stdc++.h> using namespace std; int R; vector<int> hv, use; vector<char> ans; int req[1000005]; int fr[1000005]; int main() { int n; scanf( %d , &n); if (n >= 1389) R = 4; else if (n >= 232) R = 3; else if (n >= 199) R = 2; else if (n >= 2) R =...
module encoder(in,out); input [39:0] in; output [5:0] out; assign out = (in[0]==1'b1)?6'd0: (in[1]==1'b1)?6'd1: (in[2]==1'b1)?6'd2: (in[3]==1'b1)?6'd3: (in[4]==1'b1)?6'd4: (in[5]==1'b1)?6'd5: (in[6]==1'b1)?6'd6: (in[7]==1'b1)?6'd7: (in[8]==1'b1)?6'd8: ...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; int i, j, k, l, n, m, K[120], tmp, flag, bo; struct point { int x, y; } a[120]; struct ppp { double x, y; } O; double ans; int dot(point &a, point &b, point &c, point &d) { return (b.x - a.x) * (d.x - c.x) + (b.y - a.y)...
////////////////////////////////////////////////////////////////////// //// //// //// raminfr.v //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; int P; int g1() { double p = rand() / 32767.0, s = 0, g = 1; for (int k = 0;; k++) { if (k) g *= k; double c = pow(P, k) * exp(-P) / g; s += c; if (p <= s) return k; } } int g2() { double p = rand() / 32767.0, s = 0; for...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2006 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=0; reg [63:0] crc; reg [31:0] sum; wire [15:0] out0; w...
#include <bits/stdc++.h> using namespace std; int mmax, sum, n, t; int main() { cin >> n; sum = 0; mmax = 0; for (int i = 0; i < n; i++) { cin >> t; sum += t; mmax = max(t, mmax); } cout << mmax - (sum - mmax) + 1; }
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ebi // // Generated // by: wig // on: Fri Jul 7 06:44:20 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../bugver.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author: wi...
/** * 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) 2015, Microsoft Corporation All rights reserved. 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 ...
#include <bits/stdc++.h> int main() { int p[105]; int n, m, i, j, t; memset(p, 0, sizeof(p)); scanf( %d%d , &n, &m); for (i = 0; i < m; i++) { scanf( %d , &t); for (j = t; p[j] == 0; j++) p[j] = t; } for (i = 1; i < n; i++) printf( %d , p[i]); printf( %d n , p[n]); ret...
// 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 to test...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; const int INF = 0x3f3f3f3f; int dp[N]; struct node { int v, id; } a[N][2]; void up1(int sta, int cost, int i) { if (a[sta][0].v > cost) { a[sta][1] = a[sta][0]; a[sta][0] = {cost, i}; } else if (a[sta][1].v > cost...
#include <bits/stdc++.h> using namespace std; int n, m, V, i, x, y, z, tot, e[505], fir[505], ne[505 * 2], la[505 * 2], va[505 * 2]; double v, o, a[505][505], b[505], c[505]; void ins(int x, int y, int z) { la[++tot] = y; ne[tot] = fir[x]; fir[x] = tot; va[tot] = z; } void dfs(int A, i...
#include <bits/stdc++.h> using namespace std; const long long int N = 1e9 + 7; long long int h[200009], a[200009]; int main() { long long int n, m, i, b, j, c, d, x, y, z, k, sum = 0, l, r = 1; vector<long long int> v; vector<long long int>::iterator it; cin >> n; cout << (n / 2) + 1; }
#include <bits/stdc++.h> using namespace std; double EPS = 1e-11; double a[4]; double p[4][2] = {{-1, -1}, {1, -1}, {-1, 1}, {1, 1}}; bool poss(double thr) { double min03 = numeric_limits<double>::infinity(); double max03 = -numeric_limits<double>::infinity(); double min12 = numeric_limits<double>...
#include <bits/stdc++.h> using namespace std; struct Query { int id, left, right, time, blockLeft, blockRight; Query() : id(-1), left(-1), right(-1), time(-1), blockLeft(-1), blockRight(-1) {} Query(int id, int left, int right, int time, int blockLeft, int blockRight) : id(id), ...
#include <bits/stdc++.h> using namespace std; string t(int a) { int i, tmp = 1; for (i = 1; i <= a; i *= 3) { } string s; for (; i >= 1; i /= 3) { if (a / i == 2) s += 2 , a %= i; else if (a / i == 1) s += 1 , a %= i; else s += 0 ; } return s;...
#include <bits/stdc++.h> using namespace std; template <class T, class U> inline T max(T &a, U &b) { return a > b ? a : b; } template <class T, class U> inline T min(T &a, U &b) { return a < b ? a : b; } template <class T> T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a % b) : a); } tem...
// -- (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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
// Two modules are built as part of solution // First define a 4 bit block and then reuse module jcsablock(Y,carryout,A,B,carryin); output [3:0]Y; output carryout; input [3:0]A,B; input carryin; wire [3:0]g,p;// generate and propogate wire [4:0]c;// intermediate carry of adders, one extra for coding simp...
// // Copyright (c) 2013 Colin Rothwell // All rights reserved. // // This software was developed by SRI International and the University of // Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 // ("CTSRD"), as part of the DARPA CRASH research programme. // // @BERI_LICENSE_HEADER_START@ // // Li...
/** * 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> bool debug = 1; const long long MOD = 1000000007; const double PI = acos(-1.0); const double eps = 1e-9; using namespace std; int main() { int n, m; int c[100100], a[100100]; cin >> n >> m; for (int i = 0; i < n; i++) { scanf( %d , &c[i]); } for (int i ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d %d , &n, &m); char A[147][10047]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf( %c , &A[i][j]); int P[147][10047]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) P[i][j] =...
/******************************************************************************/ /* */ /* Copyright (c) 1999 Sun Microsystems, Inc. All rights reserved. */ /* ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const int dx[8] = {0, -1, 0, 1, -1, -1, 1, 1}, dy[8] = {1, 0, -1, 0, -1, 1, -1, 1}; int a[100005]; int cnt = 0; int n, m, k; vector<int> vt[100005], vt2[2]; stack<int> st; int dfn[100005], color[100005]; void...
#include <bits/stdc++.h> using namespace std; signed main() { cin.tie(nullptr)->sync_with_stdio(false); long long _; for (cin >> _; _--;) { long long n, m, k; cin >> n >> m >> k; long long mn = (n % 2 == 1 ? m / 2 : 0); long long mx = n * m / 2 - (m % 2 == 1 ? n / 2 : 0); i...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Mon Oct 30 11:41:09 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
//hardware top level module module sm_top ( input clkIn, input rst_n, input [ 3:0 ] clkDevide, input clkEnable, output clk, input [ 4:0 ] regAddr, output [31:0 ] regData ); //metastability input filters wire [ 3:0 ] devide; 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...
/* * 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 "crt_address_decoder.v" `include "crt_register.v" module crt( input clk, input reset, input cs, input we, input [3:0] addr, inout [15:0] data, output irq, output vs, output hs, output ven, output [2:0] clksel, output [31:0] pixaddr ); // One-hot chip select bus for registers wire addr_cr, addr_ia...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, sum = 0; long long ans = 0; cin >> n; char s[n]; cin >> (s + 1); map<int, int> f; f[0] = 1; for (int i = 1; i <= n; i++) { int tmp = s[i] - 0 ; ...
//--------------------------------------------------------------------------- //-- Copyright 2015 - 2017 Systems Group, ETH Zurich //-- //-- This hardware module 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 ...
#include <bits/stdc++.h> using namespace std; int a[100005], ans[100005], ti[100005], app[100005], t, n; int cnt(int k) { int ret = 1, count = 0; ++t; for (int i = 1; i <= n; i++) { if (ti[a[i]] != t) { ti[a[i]] = t; app[a[i]] = false; } if (!app[a[i]]) { if (...
#include <bits/stdc++.h> using namespace std; int main() { long long n, t; cin >> n >> t; int d = 1; while (t > 1) { if (t % 2) { cout << 0 << endl; return 0; } t /= 2; d++; } long long dp[60][60] = {}; dp[1][1] = 1; long long cur = 1; long...
#include <bits/stdc++.h> using namespace std; bool IsPrime(int n) { if (n == 1) return false; for (int d = 2; d * d <= n; d++) { if (n % d == 0) return false; } return true; } int main() { int n; cin >> n; int count = 0; while (n > 0) { int j = 0; int k = n; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int x = (n + 3) / 4; int p = n - x; while (p--) cout << 9 ; while (x--) cout << 8 ; cout << endl; } }
/* * 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...
/* This file is part of JT12. JT12 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. JT12 is distributed in the hope that it will be us...
/** * 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 = 2002; int a[N][N] = {0}, b[N][N] = {0}; int c[N] = {0}, d[N] = {0}, e[N] = {0}, f[N] = {0}; int main() { int n, m, ans = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; ...
/* * 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; long long ar[1000010]; int main() { long long n; cin >> n; long long ans = 0; if (n % 2 == 1) puts( 0 ); else { n = n / 2; n = (n - 1) / 2; cout << n << endl; } return 0; }
module DataMem ( input clk, rst, input MemWrite, MemRead, input rx, input [31:0] addr, wdata, input [7:0] switch, output tx, output reg [31:0] rdata, output reg [7:0] led, output reg [11:0] digi, output irq ); parameter RAM_SIZE = 256; parameter RAM_BIT = 8; //...
/** * 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...
// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) an...
`timescale 1ns / 1ps /* Copyright 2015, Google Inc. 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 l...
#include <bits/stdc++.h> using namespace std; const int MAX = 1000011; bool hsh[MAX]; int fact[MAX]; void sieve(int n) { int i, a; for (i = 2; i <= n; i++) hsh[i] = true; for (i = 2; i <= n; i++) if (hsh[i]) { a = 2; fact[i] = i; while (a * i <= n) hsh[a * i] = false,...
// -*- Mode: Verilog -*- // Filename : display_regs.v // Description : Seven Segment Display Registers // Author : Philip Tracton // Created On : Thu May 28 23:27:56 2015 // Last Modified By: Philip Tracton // Last Modified On: Thu May 28 23:27:56 2015 // Update Cou...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ * * SVN revision information: * $Rev:: $: * $Author:: ...
// wasca_mm_interconnect_0_avalon_st_adapter_001.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 193 `timescale 1 ps / 1 ps module wasca_mm_interconnect_0_avalon_st_adapter_001 #( parameter inBits...
#include <bits/stdc++.h> using namespace std; const int N = 1010; char s[100]; bool ops[256]; int relabel[N * 6]; int va[N * 6][2]; int typ[N * 6]; bool vis[N * 6], beres[N * 6]; string detail[N * 6]; map<string, int> ex; map<pair<pair<int, int>, int>, int> rel; vector<string> ans; char usea; ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; const int MAXN = 1e4 + 10; const int MOD = 1e9 + 7; const int inf = 1e9; const double pi = acos(-1.0); const double eps = 1e-6; int dx[] = {0, -1, 0, 1}; int dy[] = {1, 0, -1, 0}; int x, y; int main() { ios::sync_with_stdi...
//Instruction decoder `include "verilog/riscv_instr_defines.v" module decode ( input wire[31:0] instr_dec_i, output wire[4:0] rs1_dec_o, output wire[4:0] rs2_dec_o, output wire[4:0] rd_dec_o, output wire[6:0] op_dec_o, output wire[2:0] funct3_dec_o...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); bool ok = true; int cur = -1; int q = 0; for (int i = 0; i < n; ++i) { if (q == 0) { if (cu...
/** * 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 = 1e+5 + 10; long long b[MAXN], l[MAXN], r[MAXN], o[MAXN], dp[MAXN]; int main() { int n; cin >> n; for (int i = 0; i < n - 1; i++) { cin >> b[i]; } for (int i = 1; i < n; i++) { l[i] = b[i - 1] - (b[i - 1] % 2) + l[i - ...
///////////////////////////////////////////////////////////////////// //// //// //// FIFO 4 entries deep //// //// //// //// ...
module edge_detect( input clk, //输入系统时钟 input rst_n, //复位信号,低电平有效 input rx_int, //需要检测的输入信号 output pos_rx_int, //检测到上升沿信号 output neg_rx_int, //检测到下降沿信号 output doub_rx_int //双边检测信号 ); reg rx_int0,rx_int1,rx_int2; //在内部新建寄存器,用来暂存数据信号 ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:27:45 02/22/2015 // Design Name: // Module Name: NormaliseAdder // Project Name: // Target Devices: // Tool versions: // Description: // // ...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // // Module: generic_cntr_reg.v // Project: NF2.1 // Author: Jad Naous/Glen Gibb // Description: Implements a generic counter register block that uses RAM and // temporarily stores up...
#include <bits/stdc++.h> int n; char str[50]; int F[50], sz[50]; inline int find(int x) { return x == F[x] ? x : F[x] = find(F[x]); } inline void merge(int x, int y) { x = find(x); y = find(y); if (x == y) return; F[y] = x; sz[x] += sz[y]; } std::vector<int> G[55]; int id[66]; 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 law...
#include <bits/stdc++.h> using namespace std; int main() { int n, s; cin >> n >> s; map<int, long long> sale; map<int, long long> buy; for (int i = 0; i < n; i++) { char c; cin >> c; if (c == B ) { int price, num; cin >> price >> num; buy[price] += num;...
#include <bits/stdc++.h> using namespace std; template <class T> using min_pq = priority_queue<T, vector<T>, greater<T>>; const int MAXN = 1e5 + 10, MAXQ = 3e5 + 10, MAXL = 18, ALP = 26, MOD = 1e9 + 7, MAXK = 17, MAXA = 10, MAXB = 24, MAXBB = (1 << MAXB); const string no = NO n , yes = YES n ; ...
#include <bits/stdc++.h> using namespace std; const int N = 1000 * 100 + 20; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { long long n, k; cin >> n >> k; if (k % 2 == n % 2 && (k * k) <= n) cout << YES << endl; 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...
#include <bits/stdc++.h> using int64 = long long; constexpr int Maxn = 200000; constexpr int p = 1000000007; template <class _Tp1, class _Tp2> inline void inc(_Tp1& x, const _Tp2& y) { x += y; (p <= x) && (x -= p); } template <class _Tp1, class _Tp2> inline void dec(_Tp1& x, const _Tp2& y) { ...
// ============================================================== // 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 1ns/1ps module ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Muhammad Ijaz // // Create Date: 08/08/2017 10:53:59 AM // Design Name: // Module Name: DUAL_PORT_MEMORY // Project Name: RISC-V // Target Devices: // Tool Versions: //...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1000000000 ) using namespace std; const long long inf = (long long)1e18; const long double eps = 1e-8; const long double pi = 3.1415926535; string a[100000][8]; bool u[100000][8][8]; int sx, sy, tx, ty; bool f; void dfs(int x, int y, int t) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long n, a, b, c = 0; cin >> n >> a; for (int i = 1; i <= n; i++) { if (i * n >= a && a % i == 0) c++; } cout << c; }
#include <bits/stdc++.h> using namespace std; const long long mx = 3e5 + 66; const long long mod = 1e9 + 7; const long long inf = 8e18 + 66; const int llg = 25; const long long mxk = 31700000; long long power(long long a, long long b, long long md) { if (b == 0) return 1; long long c = power(a, b ...
#include <bits/stdc++.h> using namespace std; void bktk(int i, char *s, int val, int &ans, vector<int> &cnt) { if (!s[i]) { ans += cnt[val]; return; } val *= 3; if (s[i] == A ) { bktk(i + 1, s, val, ans, cnt); bktk(i + 1, s, val + 1, ans, cnt); } if (s[i] == a ) { ...
/** * 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: 16:41:03 11/08/2015 // Design Name: Integradorv2 // Module Name: /home/rafa/Descargas/Digital/IntegradorV2/inter_tst.v // Project Name: IntegradorV2 // Target Device...
#include <bits/stdc++.h> using namespace std; int m, n, t, k; int main() { while (scanf( %d%d , &n, &k) == 2) { if (k > n || (n >= 2 && k == 1)) printf( -1 n ); else if (k == 1) printf( %c n , a ); else { int m = n - (k - 2); for (int i = 0; i < m; i++) print...
module staff( input [7:0]scan_code1, output [15:0]sound1, output sound_off1 ); //////SoundOff Key/////// assign sound_off1=(scan_code1==8'hf0)?0:1; /////////Channel-1 Trigger//////// wire L_5_tr=(scan_code1==8'h1c)?1:0;//-5 wire L_6_tr=(scan_code1==8'h1b)?1:0;//-6 wire L_7_tr=(scan_code1==8'h23)?1:0;//-7 ...
#include <bits/stdc++.h> using namespace std; const int N = 1005; const int M = 11; const int MOD = 1e9 + 7; int n, m; int dp[M][N][N]; int solve(int idx, int a, int b) { if (idx >= m) return 1; int& r = dp[idx][a][b]; if (r != -1) return r; r = solve(idx + 1, a, b); if (a < b) { ...
#include <bits/stdc++.h> using namespace std; int A, D, C; vector<int> atk, def, ciel; bool used[110]; int partial(void) { int N = min(A, C), i, ans = 0; for ((i) = 0; (i) < (int)(N); (i)++) if (atk[i] < ciel[C - 1 - i]) ans += ciel[C - 1 - i] - atk[i]; return ans; } int search(int x) { ...
#include <bits/stdc++.h> using namespace std; int n, m, a[1001][1001]; set<int> r[1001], c[1001]; map<int, int> r_m[1001], c_m[1001]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %d , &a[i][j]); r[i].insert(a[i][j]); ...
`timescale 1 ns / 1 ps module axis_lfsr # ( parameter integer AXIS_TDATA_WIDTH = 64, parameter HAS_TREADY = "FALSE" ) ( // System signals input wire aclk, input wire aresetn, // Master side input wire m_axis_tready, outpu...
// ================================================================== // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< // ------------------------------------------------------------------ // Copyright (c) 2006-2011 by Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // --------...
///////////////////////////////////////////////////////////////////// //// //// //// Discrete Cosine Transform Unit //// //// //// //// Author: Richard Herveille ...
module testbench; `include "test_bsg_clock_params.v" localparam cycle_time_lp = 20; wire clk; wire reset; localparam width_lp = 16; localparam els_lp = 4; bsg_nonsynth_clock_gen #(.cycle_time_p(cycle_time_lp)) clock_gen (.o(clk)); bsg_nonsynth_reset_gen #(.reset_cycles_lo_p(5) ...