text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; using Int = long long; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << ( << a.first << , << a.second << ) ; }; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << ... |
#include <bits/stdc++.h> long long read() { long long x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(); } return x * f; } using namespace std;... |
/**
* 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; void debug(int* a, int n, bool flag = false) { if (!flag) printf( array ); for (int i = 1; i <= n; i++) printf( %d , a[i]); printf( n ); } void debug(vector<int>& E, bool flag = false) { if (!flag) printf( vector ); for (auto it : E) printf( ... |
/*
* 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 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Sat Sep 23 13:25:26 2017
// Host : DarkCube running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int ddx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; int ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; bool debug = false; int main() { int n, L, a; cin >> n >> L >> a; int ans = 0, now = 0; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; struct node { int x, y, next; } a[1010000]; int len, last[510000]; inline void ins(int x, int y) { len++; a[len].x = x; a[len].y = y; a[len].next = last[x]; last[x] = len; } int tt[510000]; int col[510000]; int cnt, belong[510000]; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, pay = 0, kd; int U = 0, R = 0; char c; cin >> n; cin >> c; if (c == U ) { kd = 1; U++; } else { kd = 0; R++; } for (int i = 1; i < n; i++) { cin >> c; if (c == U ) U++;... |
/**
* 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; struct data { int idx, val; bool operator<(const data &a1) const { if (a1.val == val) { return a1.idx < idx; } return val > a1.val; } data(int t, int w) : idx(t), val(w) {} }; set<data> coastline; set<data>::iterator it, 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 main() { int n; cin >> n; int* m = new int[n]; int* r = new int[n]; for (int i = 0; i < n; i++) { cin >> m[i]; } for (int i = 0; i < n; i++) { cin >> r[i]; } double total = 0; for (int i = 0; i < 1000000; i++) { ... |
//----------------------------------------------------------------------------
// TFT INTERFACE - Sub Level Module
//-----------------------------------------------------------------------------
//
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
// SOLELY FOR USE IN DEVELOPING PROGRAMS AND... |
#include <bits/stdc++.h> int main(void) { int n, sum = 0; scanf( %d , &n); getchar(); char str[n]; gets(str); for (int i = 0; i < n; i++) { if (str[i] == + ) sum++; else if (str[i] == - && sum != 0) sum--; } printf( %d n , sum); return 0; } |
/*****************************************************************************
* *
* Module: Altera_UP_PS2_Data_In *
* Description: *
* ... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 0; char ch = getchar(); while (!isdigit(ch)) f |= ch == - , ch = getchar(); while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 0 ), ch = getchar(); return f ? -x : x; } inline void write(long long... |
/**
* 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; struct inf { long long v; long long b; }; bool cmp(struct inf a, struct inf c) { return a.b > c.b; } int main() { struct inf a[300005]; long long n, k, i, j, sum = 0, ans = -1, temp; cin >> n >> k; for (i = 0; i < n; i++) { cin >> a[i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> n >> t; if (n == 1 && t == 10) cout << -1 << endl; else { cout << t; if (t == 10) n--; for (int i = 0; i < n - 1; i++) cout << 0; cout << endl; } return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; pair<int, int> tc[30]; bool dp[5][110][505]; int vis[5][110][505], n, k, Trow[30], kase, stx, sty; char mp[5][110]; bool solve(int x, int y, int mv) { if (x < 1 || x > 3 || y < 1) return 0; if (y > n) return 1; bool oc1 = 0, oc2 = 0, oc3 = 0; if ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<long long> v(n + 1); long long xr = 0; for (long long i = 1; i <= n; i++) { cin >> v[i]; xr ^= v[i]; } if (xr == 0) { cout << DRAW << n ; return; } lo... |
#include <bits/stdc++.h> using namespace std; long long pow1(long long b, long long expo, long long md) { if (!expo) return 1; long long tmp = pow1(b, expo / 2, md); tmp = (tmp * tmp) % md; if (expo % 2) tmp = (tmp * b) % md; return tmp; } long long w[1000005] = {}; long long apow[1000005]... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<pair<pair<int, int>, int> > a(2 * n - 1); for (int i = 0; i < 2 * n - 1; i++) { cin >> a[i].firs... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: fpu_out.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
//... |
#include <bits/stdc++.h> using namespace std; int n, m, a, b, ans[400]; string s[400]; long long calc(int pos, int res) { for (int i = res + 1; i <= 10; i++) { for (int j = 0; j < 1 << i; j++) { string t = ; for (int k = 0; k < i; k++) t = t + (char)(((j >> k) & 1) + 0 ); if... |
//---------------------------------------------------------------------------------------
// uart transmit module
//
//---------------------------------------------------------------------------------------
module uart_tx
(
clock, reset,
ce_16, tx_data, new_tx_data,
ser_out, tx_busy
);
//-----------... |
// hub_mem
/*
-------------------------------------------------------------------------------
Copyright 2014 Parallax Inc.
This file is part of the hardware description for the Propeller 1 Design.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pub... |
/*
* Copyright (c) 2013, Quan Nguyen
* 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 must retain the above copyright notice, this
* list of conditi... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; double dis(long u, long v, long p, long q) { return sqrt(((double)u - p) * (u - p) + ((double)q - v) * (q - v)); } struct point { int x; int y; }; int main() { int n, m; cin >> n >> m; if (n == 0) { cout << 0 <... |
#include <bits/stdc++.h> const int N = (int)2e5 + 5; const int MOD = (int)1e9 + 7; const bool MULTI_TEST = true; const double PI = acos(-1.0); using namespace std; void solve() { int n; cin >> n; int a[n]; int max = 0, index = -1; for (int i = 0; i < n; i++) { cin >> a[i]; if... |
#include <bits/stdc++.h> using namespace std; int n, k; int a[100010]; int tot[200010]; int dis[200010]; int main() { queue<int> q; scanf( %d%d , &n, &k); for (int i = 0; i <= 4000; ++i) dis[i] = 1e9; for (int i = 1; i <= k; ++i) { scanf( %d , &a[i]); a[i] -= n; ++tot[a[i] ... |
#include <bits/stdc++.h> //#include <bits/extc++.h> #define ll long long #define endl n #define pb push_back #define ms(v,x) memset(v,x,sizeof(v)) #define ff first #define ss second #define td(v) v.begin(),v.end() #define rep(i,a,n) for (int i=(a);i<(n);i++) #define per(i,a,n) for (int i=(n-1);i>... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2007 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg toggle;
integer cyc; initial cy... |
#include <bits/stdc++.h> using namespace std; int v[11][100010]; int vmap[11][100010]; int pointer[11]; int main() { int n, m; scanf( %d %d , &n, &m); long long ans = 0; for (int j = 0; j < m; j++) { for (int i = 0; i < n; i++) { scanf( %d , &v[j][i]); v[j][i]--; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; } template <typename T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; } int readint() { int x = 0, f = 1; char ch = getchar(); while (ch < ... |
(** * Gen: Generalizing Induction Hypotheses *)
(* $Date: 2011-06-07 16:49:17 -0400 (Tue, 07 Jun 2011) $ *)
Require Export Poly.
(** In the previous chapter, we noticed the importance of
controlling the exact form of the induction hypothesis when
carrying out inductive proofs in Coq. In particular, we need ... |
/*
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon May 08 17:42:47 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; template <class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; } template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> int getbit(T s, int i) { return ... |
`timescale 1ns / 1ps
module nkmd_ddr3_mig_if_t;
// ins
reg clk;
parameter TCLK = 20;
initial clk = 0;
always #(TCLK/2) clk = ~clk;
reg rst;
reg [31:0] nkmd_data_i;
wire [31:0] nkmd_data_o;
reg [15:0] nkmd_addr;
reg nkmd_we;
reg [31:0] mig_rd_data;
reg [6:0] mig_rd_count;
nkmd_ddr3_mig_if uut(
.clk(clk),
.... |
#include <bits/stdc++.h> using namespace std; int a[25] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 4, 9, 25, 49}; int main() { string s; int num = 0; for (int i = 0; i < 19; i++) { printf( %d n , a[i]); fflush(stdout); cin >> s; if (s == ye... |
`timescale 1ns / 1ns
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:28:18 02/06/2014
// Design Name:
// Module Name: test1
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
//... |
#include <bits/stdc++.h> using namespace std; int n, m; int x; int dfs(int xx, int yy, int cc) { if (cc == 0) { if (xx == 1 || yy == 1) { int tt = xx * yy; if (tt % 2 == 0) return tt / 2; else return tt / 2 + 1; } else return ((xx + yy) * 2 - 4... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; cout << (a + b + f) * (a + b + f) - b * b - d * d - f * f << endl; return 0; } |
// DESCRIPTION: Verilator: Test of gated clock detection
//
// The code as shown generates a result by a delayed assignment from PC. The
// creation of the result is from a clock gated from the clock that sets
// PC. Howevever since they are essentially the same clock, the result should
// be delayed by one cycle.
//
/... |
#include <bits/stdc++.h> using namespace std; long long N; long long x, y, x2, y2; pair<int, int> v[100010]; bool Can(long long n) { long long Rem = n % N; long long Count = n / N; long long X = v[Rem].first + (v[N].first * Count); long long Y = v[Rem].second + (v[N].second * Count); retur... |
#include <bits/stdc++.h> using std::pair; using std::string; using std::vector; template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; } template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; } const int oo = 0x3f3f3f3f; string procStatus() { s... |
#include <bits/stdc++.h> using namespace std; double x[1005], y[1005], z[1005], r[1005]; long long int n, m; int main() { double res = (1ll << (long long int)(60)), ax, ay, az, vx, vy, vz, R; cin >> ax >> ay >> az >> vx >> vy >> vz >> R >> n; for (long long int i = 0; i < ((long long int)(n)); i++) ... |
#include <bits/stdc++.h> using namespace std; int a, b, c; vector<int> ans; int sum(int curr) { int sum = 0; while (curr > 0) { sum += curr % 10; curr = curr / 10; } return sum; } long long go(long long x, int n) { long long ans = 1; for (int i = 0; i < n; i++) { an... |
#include <bits/stdc++.h> using namespace std; int a[500009], posin[500009]; vector<int> pairs[500009]; int main() { int n, m, x, y, c = 0; scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); posin[a[i]] = i; } for (int i = 0; i < m; i++) { scanf( %d %d ... |
// Automatically generated: write_netlist -wrapapp -verilog -module reconflogic-wrapmax6682.v
module MyReconfigLogic (
input Reset_n_i,
input Clk_i,
input AdcConvComplete_i,
output AdcDoConvert_o,
input[9:0] AdcValue_i,
input I2C_Busy_i,
output[7:0] I2C_DataIn_o,
input[7:0] I2C_DataOut_i,
output[15:0... |
module grid_AD7490(
input rsi_MRST_reset,
input csi_MCLK_clk,
input [31:0] avs_ctrl_writedata,
output [31:0] avs_ctrl_readdata,
input [3:0] avs_ctrl_address,
input [3:0] avs_ctrl_byteenable,
input avs_ctrl_write,
input avs_ctrl_read,
output avs_ctrl_waitrequest,
input csi_ADCCLK_clk,
outp... |
/**
* 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> struct node { double x, y, z; } p[5005]; double d[5005]; double getlen(node a, node b) { double len; len = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z); return sqrt(len); } int main() { int n, i, j, a, b, c; whil... |
// Based on US Patent # 4,486,739 (expired)
// Byte Oriented DC Balanced 8B/10B Partitioned Block Transmission Code
// Author: Franaszek et al.
//
// https://patentimages.storage.googleapis.com/67/2d/ad/0258c2f0d807bf/US4486739.pdf
//
`include "bsg_defines.v"
module bsg_8b10b_encode_comb
( input [7:0] data_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... |
#include <bits/stdc++.h> using namespace std; long long data[4 * 150005], lazy[4 * 150005], ret; int ll, rr, n, m; void change(int t, long long d) { data[t] = lazy[t] = d; } void down(int t) { if (lazy[t]) { change(t * 2, lazy[t]); change(t * 2 + 1, lazy[t]); lazy[t] = 0; } } voi... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 07/07/2016 09:24:55 AM
// Design Name:
// Module Name: Deslinealizador
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
/... |
#include <bits/stdc++.h> using namespace std; void bringToTen(int &k, int &rating, vector<int> &bucket) { for (int i = 9; i > 0; i--) { int x = 0; while (x < 100) { int h = min(k / (10 - i), bucket[x + i]); k -= h * (10 - i); bucket[x + 10] += h; rating += h; ... |
/*
* 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 size = 1e5 + 7; long long a[size], ans = 2e9, res, val, n, k, i; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; for (i = 0; i < n; i++) { cin >> a[i]; if (!i) val = a[i] % k; ... |
`timescale 1ns/10ps
module pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("false"),
.reference_clock_frequency("50.0 MHz"),
.ope... |
#include <bits/stdc++.h> using namespace std; int a[3], b[3]; int main() { int n, m; ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i = 1; i <= n; ++i) { int c; cin >> c; a[c % 2]++; } for (int j = 1; j <= m; ++j) { int c; cin >> c; ... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2009 Xilinx, Inc.
// This design is confidential and proprietary of Xilinx, All Rights Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ /... |
/*
* 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; using ll = long long; using db = double; using pii = pair<int, int>; using vi = vector<int>; const int N = 1e5 + 100; int n, d[N], f[N][2], ans; vi G[N]; void dfs(int x, int fz) { f[x][0] = 0, f[x][1] = 1; for (int y : G[x]) if (y != fz) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 15; vector<int> g[N]; int n, m, b[N], r[N], a[N], res; void dfs(int v, int pa) { if (a[v] == 1) r[v]++; else if (a[v] == 2) b[v]++; for (int i : g[v]) { if (i == pa) continue; dfs(i, v); b[v] += b[i]; ... |
#include <bits/stdc++.h> using namespace std; template <class T> ostream& operator<<(ostream& os, vector<T> V) { os << [ ; for (auto v : V) os << v << ; os << ] ; return os; } template <class T> ostream& operator<<(ostream& os, set<T> second) { os << { ; for (auto s : second)... |
`default_nettype none
package testcase_pkg;
typedef int unsigned uint;
localparam uint SIZE = 8;
typedef enum {ENUM1, ENUM2} enum_t;
endpackage
module testcase_top
(
input testcase_pkg::enum_t top_enum,
input logic [testcase_pkg::SI... |
module main;
wire out;
reg [1:0] A, B;
ge2 dut(.out(out), .A(A), .B(B));
initial begin
A = 0;
B = 0;
#1 $display("%b >= %b: %b", A, B, out);
B = 1;
#1 $display("%b >= %b: %b", A, B, out);
B = 2;
#1 $display("%b >= %b: %b", A, B, out);
B = 3;
#1 $di... |
/*
* 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> using namespace std; const int maxn = 1e5 + 5; const unsigned long long base = 311; unsigned long long TH[maxn][3], L[3], P[maxn]; int Sol, lona, lonb; void calc_Hash(string& a, int id) { int lon = L[id]; for (int i = (1); i <= (lon); i += (1)) { TH[i][id] = TH[i - 1][... |
#include <bits/stdc++.h> using namespace std; const int M = 400005; int read() { int x = 0, flag = 1; char c; while ((c = getchar()) < 0 || c > 9 ) if (c == - ) flag = -1; while (c >= 0 && c <= 9 ) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return x * flag; } int... |
/*******************************************************************************
*
* NetFPGA-10G http://www.netfpga.org
*
* File:
* generate_stream.v
*
* Library:
* hw/osnt/pcores/osnt_10g_interface_v1_11_a
*
* Module:
* rx_queue
*
* Author:
* Mario Ruiz
*
*
* Copyrigh... |
//
//////////////////////////////////////////////////////////////////////////////////
// Copyright © 2010, Xilinx, Inc.
// This file contains confidential and proprietary information of Xilinx, Inc. and is
// protected under U.S. and international copyright and other intellectual property laws.
///////////////////... |
// MBT 11/26/2014
//
// bsg_nonsynth_fsb_node_trace_replay
//
// note: generally it is better to use
// bsg_fsb_node_trace_replay
// than this module, because 1)
// it is synthesizeable, and 2)
// it may have races (see fixme)
//
// trace format
//
//
// 0: wait one cycle
// 1: send data
// 2: r... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_debug_if.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; int tux, foo, bar, baz, quz = 1; int main() { scanf( %d , &tux); for (int i = 1; i <= tux; ++i) { int pur; scanf( %d , &pur); foo += pur, bar++; if (foo * quz > baz * bar) baz = foo, quz = bar; } printf( %.6lf , baz * 1.0 / quz)... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<pair<int, int>> dec; vector<pair<int, int>> inc; dec.push_back({1e7, 0}); inc.push_back({-... |
#include <bits/stdc++.h> const long long mod = (long long)1e9 + 7; const int maxn = (int)1e5 + 1; long long inf = 1LL << 60; using namespace std; inline void read(int &n) { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); ... |
#include <bits/stdc++.h> using namespace std; const int N = 200; int n, a[N], m; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); scanf( %d , &m); for (int i = 0; i < m; i++) { int x, y; scanf( %d%d , &x, &y); x--; if (x - 1 >= 0) a[x - 1] += ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 20; const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const long long LLINF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1.0); const double RATE = 0.995; const double eps = 1e-4; int arr[MAXN][MAXN]; signed main() { int n; ... |
#include <bits/stdc++.h> using namespace std; int main() { string A; cin >> A; if (A.size() > 1 and A.size() % 2 == 0) { int x = (A.size() / 2) - 1; cout << A[x]; for (int i = 1; i <= x; i++) { cout << A[x + i] << A[x - i]; } cout << A[2 * x + 1]; } else if (A.s... |
#include <bits/stdc++.h> using namespace std; int n; int p[300]; int main() { int i, k, j, l; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (i = 0; i < 2 * n; i++) { cin >> p[i]; } n *= 2; int result = 200000000; for (i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; int a[maxn]; int n, s; int main() { scanf( %d%d , &n, &s); if (s >= 2 * n) { s -= 2 * n; puts( YES ); printf( %d , 2 + s); for (int i = 1; i < n; ++i) printf( %d , 2); puts( ); puts( 1 ); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, h, a, road_width = 0; cin >> n >> h; for (int i = 0; i < n; i++) { cin >> a; if (a > h) road_width += 2; else road_width++; } cout << road_width << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( O3 ) #pragma GCC target( avx ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) const int MOD = 1000000007; const int INF = 1000000009; co... |
#include <bits/stdc++.h> using namespace std; unsigned long long F(unsigned long long n) { if (n < 10) return n; unsigned long long nn = n; int firstDig = 0; while (n) { firstDig = n % 10; n /= 10; } return (nn / 10) + 9 - (firstDig > (nn % 10)); } int main() { unsigned l... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string name; ostringstream convert; for (int i = 1; i <= n; i++) { convert << i; name = convert.str(); } cout << name[n - 1]; return 0; } |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Reset_Delay_block1.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int N = 1e9; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n + 5]; long long ans = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; ans += a[i] * a[i]; } sort(a + 1, 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 law... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [31:0] in_a;
reg [31:0] in_b;
... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 7; const int MOD = 1e9 + 7; vector<int> Gimp[MAXN]; vector<int> Gcrew[MAXN]; vector<int> G[MAXN]; int comp[MAXN]; int compSize[MAXN]; bool vis[MAXN]; bool col[MAXN]; bool ans; int res; int allSize; void DFScomp(int v, int n... |
#include <bits/stdc++.h> const long long mod = (long long)1e9 + 7; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, m; cin >> n >> m; vector<long long> v(m); bool valid = true; for (long long i = 0; i < m; 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... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module m26_rx #(
parameter BASEADDR = 16'h0000,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.