text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> long long strange[100001]; int main() { for (int i = 1; i <= 100000; i++) { long long a = i, b = i; while (b) { a *= 10; a += b % 10; b /= 10; } strange[i] = a; } long long k, p; while (scanf( %lld%lld , &k, &p) != EOF) { ... |
/*****************************************************************************
* *
* Module: Altera_UP_Clock_Edge *
* Description: *
... |
/*
* 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; inline long long read() { long long s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) w = -1; for (; isdigit(ch); ch = getchar()) s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; } inline void print(lo... |
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2014.4 (win64) Build Wed Nov 12 18:52:34 MST 2014
//Date : Tue Jun 23 14:17:06 2015
//Host : RRNTU-MV01 running 64-bit major release (build ... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
//
// Data RAM for Tawas Core
//
module dram
(
input clk,
input [31:0] addr,
input cs,
input wr,
input [3:0] mask,
input [31:0] din,
output [31:0] dout
);
parameter DRAM_DATA_FILE = "dram... |
#include <bits/stdc++.h> using namespace std; char c[600][600]; int check(int x, int y) { if (c[x][y - 1] == * && c[x][y + 1] == * && c[x + 1][y] == * && c[x - 1][y] == * && c[x][y] == * ) return 1; return 0; } int main() { int m, n; cin >> n >> m; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; using namespace std; const long long int mod = 1e9 + 7; const long long int MAX = LLONG_MAX; const long long int MIN = LLONG_MIN; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long int n, k; cin >> n... |
#include <bits/stdc++.h> using namespace std; char d[8][8]; int i, j, sch, k, m; int main() { k = 0; m = 0; for (i = 0; i < 8; i++) { sch = 0; for (j = 0; j < 8; j++) { cin >> d[i][j]; if (d[i][j] == B ) sch++; } if (sch == 8) k++; else if (sch ... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsquare
// ============================================================
// File Name: mult16.v
// Megafunction Name(s):
// altsquare
//
// Simulation Library Files(s):
// altera_mf
// ==========================... |
#include <bits/stdc++.h> using namespace std; vector<int> o, p, e; int n, i, j, x; int a[200000], b[200000]; struct T { int i; } t; bool operator<(T t1, T t2) { if ((t2.i - x - a[b[t2.i]] + 2 * n) % n != (t1.i - x - a[b[t1.i]] + 2 * n) % n) return (t2.i - x - a[b[t2.i]] + 2 * n) % n ... |
#include <bits/stdc++.h> const long long int mod = 1000000007; const long long int AM = 2e6 + 5; using namespace std; long long int powm(long long int a, long long int b, long long int n) { long long int x = 1, y = a; while (b > 0) { if (b % 2 == 1) { x = (x * y) % n; } y = (y ... |
// DEFINES
`define BITS 4 // Bit width of the operands
module bm_stmt_all_mod(clock,
reset_n,
a_in,
b_in,
out1,
out0,
out3,
out4,
out5,
out6,
out7,
out8,
out10,
out9);
// SIGNAL DECLARATIONS
input clock;
input reset_n;
input [`BITS-1:0] a_in;
input b_in;
output [`BITS-1:0] ou... |
#include <bits/stdc++.h> using namespace std; const long long neutral = 0; class SegmentTree { vector<long long> a; int n; public: SegmentTree(long long* st, long long* en) { int sz = int(en - st); for (n = 1; n < sz; n <<= 1) ; a.assign(n << 1, neutral); for (int... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
module daala_idct4_stream_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_AXIS
parameter integer C_S00_AXIS_TDATA_WIDTH = 64,
// Parameters of Axi Master Bus Interface M00_AXIS
parameter in... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.2
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
`timescale 1 ns / 1 ps
... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
/**
* 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 dp[2][4004]; struct node { int st; int cost; } save[4004]; int n, k; void checkmin(int &a, int b) { if (a == -1 || a > b) a = b; } int main() { int i, j; int ans; while (~scanf( %d%d , &n, &k)) { memset(dp, -1, sizeof(dp)); ... |
//-- //////////////////////////////////////////////////////////////////////////////
//-- /// Copyright (c) 2013, Jahanzeb Ahmad
//-- /// All rights reserved.
//-- ///
//-- /// Redistribution and use in source and binary forms, with or without modification,
//-- /// are permitted provided that the following conditions a... |
//% @file data_sampler_fifo.v
//% @brief Take a snippet of data into fifo and interface to fifo readout.
//% @author Yuan Mei
//%
`timescale 1ns / 1ps
module data_sampler_fifo
#(
parameter DIN_WIDTH = 512,
parameter DOUT_WIDTH = 32
)
(
input RESET,
input C... |
#include <bits/stdc++.h> using namespace std; const int dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1}; const double EPS = 1e-8; const double PI = acos(-1.0); int popcount(int n) { return __builtin_popcount(n); } int popcount(long long n) { return __builtin_popcountll(n); } template <class T> int SIZE(T a) ... |
#include <bits/stdc++.h> int main() { char name[100], winner[100]; int sh, uh, a, b, v, c, d, e; int n, i; int sum; int total = sum; scanf( %d , &n); scanf( %s %d %d %d %d %d %d %d , name, &sh, &uh, &a, &b, &c, &d, &e); sum = sh * 100 - uh * 50 + a + b + c + d + e; total = sum; ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-6; const int INF = 0x3f3f3f3f, N = 2000005, M = 2000005, MOD = 1e9 + 7; int sgn(double x) { return x < -eps ? -1 : (x < eps ? 0 : 1); } int Rand(int x) { return rand() * rand() % x + 1; } vector<int> G[N]; int dep[N]; double ans = 0; ... |
//----------------------------------------------------------------------------
//-- Prueba de tranmision 2. Se transmite el caracter "A" cada 100ms
//------------------------------------------
//-- (C) BQ. September 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//--
//--------------------------------------... |
#include <bits/stdc++.h> using namespace std; int n, a[100001]; vector<vector<pair<int, int>>> o[6], ans; void relax(vector<int>& m) { o[m.size()].push_back({}); for (size_t i = 0; i < m.size(); i++) o[m.size()].back().push_back({m[i], m[(i + 1) % m.size()]}); m.resize(1); } void gao(int x... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, k, p, s; cin >> n; int a[5][5]; for (i = 1; i <= 4; i++) { for (j = 1; j <= 4; j++) { cin >> a[i][j]; } } s = 0; for (i = 1; i <= 4; i++) { k = min(a[i][1], a[i][2]); p = min(a[i][3], ... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
#include <bits/stdc++.h> using namespace std; long long a[3000], b[3000]; map<long long, pair<long long, long long> > mymap; pair<long long, long long> p1, p2; int main() { std::ios::sync_with_stdio(false); long long n, m, sa = 0, sb = 0; p1.first = p1.second = p2.first = p2.second = -1; mymap... |
//==================================================================================================
// Filename : tb_CORDIC_Arch3.v
// Created On : 2016-10-03 23:39:40
// Last Modified : 2016-10-28 20:53:04
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnolog... |
#include <bits/stdc++.h> using namespace std; void init() { cin.tie(0); cin.sync_with_stdio(0); } int main() { init(); int n, z; cin >> n >> z; for (int i = 0; i < z; i++) { (n % 10 == 0) ? n /= 10 : n -= 1; } cout << n << endl; } |
#include <bits/stdc++.h> using lli = long long int; using li = long int; using namespace std; const lli MOD{1000000007}; const lli INF{(false ? (INT_MAX - 1) / 2 : (lli)1e18 + 5)}; const lli N{200005}; int main() { cout << setprecision(15); cin.tie(nullptr)->sync_with_stdio(false); li T{1}; ... |
#include <bits/stdc++.h> using namespace std; const long long INF64 = 1e18 + 1337; const int INF32 = 1e9 + 228; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, s; cin >> n >> s; vector<long long> a(n); long long sum = 0; ... |
#include <bits/stdc++.h> using std::max; const int N = 3e5 + 5; template <typename T> void read(T &x) { bool neg = false; unsigned char c = getchar(); for (; (c ^ 48) > 9; c = getchar()) if (c == - ) neg = true; for (x = 0; (c ^ 48) < 10; c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);... |
#include <bits/stdc++.h> using namespace std; inline int inp() { return 0; } inline int inp(bool& A) { if (cin >> A) return 1; return -1; } inline int inp(char& A) { return scanf( %c , &A); } inline int inp(int& A) { return scanf( %d , &A); } inline int inp(float& A) { if (cin >> A) return 1;... |
//#############################################################################
//# Function: MIO Configuration Registers #
//# (See README.md for complete documentation) #
//#############################################################################
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/23/2016 11:31:21 AM
// Design Name:
// Module Name: multiplier
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; int main() { int m, n, k, i, j, t, x; int c[200]; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; c[i] = a[i]; } cin >> m; int b[m]; for (j = 0; j < m; j++) { cin >> b[j]; c[i + j] = b[j]; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; const int MOD = 1e9 + 7; int n, m; vector<int> tmp; vector<int> g[N]; int cnt1[N]; int marked[N]; int f[N]; map<vector<int>, int> cnt; int product(int a, int b) { return (1ll * a * b) % MOD; } void mult(int &a, int b) { a = (1l... |
#include <bits/stdc++.h> using namespace std; const long long LINF = 1001002003004005006ll; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; re... |
/**
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
`define STRINGIFY(x) `"x`"
`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), ... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int a[N]; struct Block { int len, st, ed, num; Block(const int len = 0, const int st = 0, const int ed = 0, const int num = 0) : len(len), st(st), ed(ed), num(num){}; }; vector<Block> v; bool islucky(int a) { ... |
#include <bits/stdc++.h> using namespace std; int tree[27][2000000 + 5]; vector<int> data[244]; int del[2000000 + 6]; int read(int t, int idx) { int sum = 0; while (idx > 0) { sum += tree[t][idx]; idx -= (idx & -idx); } return sum; } void update(int t, int idx, int val) { w... |
/*
* 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 / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:54:12 08/27/2015
// Design Name: display
// Module Name: A:/Dropbox/University/Computing/COMP3601/AudioController/display_tbw.v
// Project Name: AudioController
/... |
#include <bits/stdc++.h> using namespace std; int main() { int t = 1; cin >> t; while (t--) { long long int n; cin >> n; cout << n << n ; } return 0; } |
#include <bits/stdc++.h> using namespace std; int vis[51]; int main() { string s; int n, len; cin >> len >> n; cin >> s; while (n--) { for (int i = 0; i <= len; i++) { if (s[i] == B && s[i + 1] == G ) { swap(s[i], s[i + 1]); i++; } } } ... |
#include <bits/stdc++.h> using namespace std; const int N = 10010; const int M = 15; const double eps = 1e-7; const int INF = 1 << 30; int n; struct node { double x, y, z; node() { x = y = z = 0; } node(double xx, double yy, double zz) { x = xx; y = yy; z = zz; } } poy[... |
// Author: Adam Nunez,
// Copyright (C) 2015 Adam Nunez
//
// 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 2
// of the License, or (at your option) any later version.
//
//... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1000000000 ) #pragma GCC optimize( Ofast,no-stack-protector ) using namespace std; const int maxn = (int)1e5 + 10; vector<int> ed[maxn]; int sz[maxn]; void dfs(int v, int p) { sz[v] = 1; for (int u : ed[v]) { if (u != p) { dfs(... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; int arr[m]; for (int i = 0; i < m; i++) cin >> arr[i]; long long res = arr[0]; for (int i = 1; i < m; i++) { if (arr... |
// ***************************************************************************
// ***************************************************************************
// 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, num, k; pair<int, int> a[200005]; bool comp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; } int main() { ios::sync_with_stdio(0); cin.tie(NULL); int t = 1; cin >> t; while (t--) { cin >> n >> k; unordered_... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2021 by wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
parameter string ES = "";
parameter EI = ""; // B is an integer of width 8
parameter s... |
#include <bits/stdc++.h> using namespace std; int d(int a, int b, int a1, int b1) { return abs(a - a1) + abs(b - b1); } int main() { int n; cin >> n; int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2; if (y1 == y2 && (y1 == 0 || y1 == n)) { cout << abs(x1 - x2) << endl; return 0; ... |
#include <bits/stdc++.h> using namespace std; long long a[100005], tmp[100005], b[100005]; bool die[100005]; int n, m; vector<long long> candidate; bool solve(int pos) { candidate.clear(); for (int i = 1; i <= n; i++) if ((!die[i]) && (a[i] & (1ll << pos))) { candidate.push_back(a[i]);... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100500; struct matrix { long double a[3][3]; void clear() { memset(a, 0, sizeof(a)); } matrix operator*(const matrix &y) { matrix ans; ans.clear(); for (int i = (0), iend = (2); i <= iend; i++) for (int j = (0), j... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/25 09:07:01
// Design Name:
// Module Name: counters_8bit_with_T_ff
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencie... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; bool watched[1000001]; cin >> n; while (cin >> x) watched[x] = true; for (int i = 1; i <= n; i++) if (!watched[i]) cout << i; return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxl = 60, w = 10000; struct Big { int s[maxl], l; Big() { memset(s, 0, sizeof(s)); l = 1; } inline void fix() { for (int i = 1; i < l; i++) { if (s[i] >= w) { s[i + 1] += s[i] / w; s[i] %= w; ... |
/*
* 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... |
`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... |
#include <bits/stdc++.h> using namespace std; int a[5]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); cout << a[n / 2]; } |
#include <bits/stdc++.h> const long long MOD = 1e9 + 7; using namespace std; long long n, u, v, ans, dp[100005], cntt[100005]; vector<vector<long long> > g(100005); bool used[100005]; long long bpow(long long x, long long p) { if (p == 0) return 1; long long cur = bpow(x, p >> 1); cur = (cur * c... |
/*******************************************************************
*****串口接收模块
*****1:确认开始位(检测低电平)
*****2:采集8bit有效数据位
*******************************************************************/
module Uart_rx(
input clk, //系统50MHz时钟
input rst_n, //复位,低电平有效
input rs23... |
module adder_tb;
parameter N_BITS_A = 3;
parameter BIN_PT_A = 1;
parameter SIGNED_A = 1;
parameter N_BITS_B = 4;
parameter BIN_PT_B = 3;
parameter SIGNED_B = 0;
parameter N_BITS_OUT = 6;
parameter BIN_PT_OUT = 3;
reg [N_BITS_A-1:0] a;
reg [N_BITS_B-1:0] b;
wire [N_BITS_OUT-1:0] sum;
initial ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 212345, OFFSET = 3; struct BITree { long long a[MAXN]; void clear() { memset(a, 0, sizeof(a)); } int lowbit(int i) { return (i & -i); } long long sum(int i) { long long ret = 0; for (i += OFFSET; i > 0; i -= lowbit(i)) ret ... |
#include <bits/stdc++.h> using namespace std; const int mx = 1e2 + 10; const long long mod = 1e9 + 31; mt19937 mtrand(time(0)); int n, m; char s[2][1 << 12]; int mp[2][1 << 14]; int f[1 << 15], ans, pr[1 << 15]; int unfd(int x) { int r = x; while (r != f[r]) r = f[r]; int t; while (f[x... |
/**
* 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... |
//Legal Notice: (C)2019 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... |
/*+--------------------------------------------------------------------------
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> using namespace std; long long n, s, k; string u; long long r[60], dp[2501][60]; signed main() { cin >> n >> s >> k; for (long long i = 0; i < n; ++i) cin >> r[i]; cin >> u; for (long long i = 0; i < n; ++i) for (long long j = 0; j < n; ++j) dp[i][j] = -1e18; ... |
#include <bits/stdc++.h> using namespace std; int main() { vector<long long> num(1, 0); vector<long long> arr(1, 0); for (int i = 1; i <= 1e5; i++) { num.push_back(num.back() + 1 + floor(log10(i))); arr.push_back(arr.back() + num.back()); } int q; cin >> q; while (q--) { ... |
#include <bits/stdc++.h> using namespace std; int main() { string a; string b; cin >> a >> b; long long int len1 = a.length(); long long int len2 = b.length(); if (a.compare(b) == 0) { cout << -1 n ; } else { if (len1 > len2) cout << len1 << n ; else ... |
#include <bits/stdc++.h> using namespace std; int const N = 1e5 + 10; using ll = long long; ll const INF = 0x3f3f3f3f3f3f3f3fll; struct edge { ll to, cost, id; edge(ll to = 0, ll cost = 0, ll id = 0) : to(to), cost(cost), id(id) {} }; vector<edge> e[N]; ll d[N]; vector<ll> p[N]; ll n, m, k; ... |
#include <bits/stdc++.h> using namespace std; int F[1024]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; char a; int b; for (int mask = 0; mask < (1 << 10); mask++) { F[mask] = mask; } for (int i = 0; i < n; i++) { cin >> a >> b; f... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:46:03 03/11/2015
// Design Name: Arithmetic_Logic_Unit
// Module Name: F:/ISE/work/cpu/cpu/ALU_Test.v
// Project Name: cpu
// Target Device:
// Tool versions: ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1050; pair<int, int> a[MAX_N]; int cnt[MAX_N]; int sub[MAX_N]; map<int, int> ids; int inds[MAX_N]; int id = 0; int countplz(int f0, int f1) { memset((sub), 0, sizeof(sub)); ++sub[a[f0].second]; ++sub[a[f1].second]; int ans... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
//-----------------------------------------------------------------------------
// Title :Block level wrapper
//-----------------------------------------------------------------------------
// File : xgbaser_gt_same_quad_wrapper.v ... |
#include <bits/stdc++.h> using namespace std; long long par[200000]; long long ran[200000]; long long cnt[200000]; void init(long long n) { for (long long i = 0; i <= n; i++) { par[i] = i; ran[i] = 0; } } long long finds(long long x) { if (par[x] == x) return x; else ... |
/**
* 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... |
/**
* 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... |
/// date:2016/3/5
/// engineer :ZhaiShaoMin 3/6 am: 10:57 done!
/// module function :because accesses come from three different sources:cpu,IN_req/rep(at one time ,only req or rep),mem
/// so here we need a arbiter to determine who can access data cache finally.
module arbiter_for_dcache(//input
... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 3;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bo... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000030; int num[MAXN]; int a[MAXN], b[MAXN]; int dex[MAXN]; int res[MAXN]; int bsch(int le, int ri, int key) { int l = le, r = ri; while (l <= r) { int m = (l + r) / 2; if (res[m] == key) return m; else if (r... |
/**
* 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 = 2e5 + 10; const int base = 31337; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; const int logo = 20; const int off = 1 << logo; const int treesiz = off << 1; int n; int niz[maxn]; int main() { scanf( %d , &n); for (int i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
`timescale 1ns / 1ps
/*******************************************************************************
* Engineer: Robin zhang
* Create Date: 2016.09.10
* Module Name: spi_slave_b2b
* this module will get 64 bytes and then return the count 64 at next clks
*************************************************************... |
#include <bits/stdc++.h> using namespace std; struct creature { long long hp, dmg; long long div; bool operator<(const creature& rhs) const { return div > rhs.div; } }; int n, a, b; creature in[200050]; long long ans = 0; int it, use; int main() { ios::sync_with_stdio(false); cin.tie... |
// 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(words,bits,lgEls,newBits,mux) \
if (els_p == words && width_p == bits) \
begin: macro \
tsmc180_1rw_l... |
module peripheral_SD(clk , reset , d_in , cs , addr , rd , wr, d_out, sclk, mosi, miso, ss );
input clk;
input rst;
input [15:0]d_in;
input cs;
input [3:0]addr; // 4 LSB from j1_io_addr
input rd;
input wr;
output reg [15:0]d_out;
input reset;
output sclk;
input miso;
output mosi;
output ss;... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; int n, m, k, second; int a[500005]; int b[500005]; int cnt[500005]; int rbd[500005]; int stat[500005]; int app[500005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> ... |
#include <bits/stdc++.h> using namespace std; int n, qc; int a[100005]; int freq[100005], ord[100005], inv[100005]; int cnt[100005] = {}, small[100005] = {}; int from[100005], to[100005]; const int ROOT = 320; const int BIG_COUNT = 100; const int SMALL = (100000 + BIG_COUNT - 1) / BIG_COUNT; inline ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.