text
stringlengths
59
71.4k
//Legal Notice: (C)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 do...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.3 (win64) Build Wed Oct 4 19:58:22 MDT 2017 // Date : Fri Nov 17 14:55:09 2017 // Host : egk-pc running 64-bit major release (build...
#include <bits/stdc++.h> using namespace std; bool sePuede(int rango[], int x) { if (x % 2 == 1 && rango[0] == 1 && rango[x - 1] == 1) return true; return false; } int main() { int x = 0; int impar = 0; cin >> x; int rango[x]; for (int y = 0; y < x; y++) { cin >> rango[y]; ...
// file: DemoInterconnect_clk_wiz_0_0.v // // (c) Copyright 2008 - 2013 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; cin.get(); string s; getline(cin, s); vector<int> pref(n); for (int i = 0; i < n; ++i) { if (i != 0) pref[i] = pref[i - 1]; pref[i] += s[i] == ( ? +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 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:45:40 05/24/2015 // Design Name: // Module Name: binary_to_BCD_fourteen_bit // Project Name: // Target Devices: // Tool versions: // Description: // // D...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2013 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; `ifdef INLINE_A //verilator inline_module `...
/* * 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 N = 1e6 + 11; const long long MOD = 1e18; long long a[N], b[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long x, y, l, r; cin >> x >> y >> l >> r; vector<long long> v; long long k = 1, kk = 1; ...
#include <bits/stdc++.h> using namespace std; int max_of_num; int n, test_Q, point_num[100005], f_delp[100005][2]; vector<int> vc[100005]; bool flag = false; void search1(int u, int fa) { for (int i = 0; i < vc[u].size(); i++) { int v = vc[u][i]; if (v != fa) { if (point_num[v] == 1)...
/* 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 tha...
#include <bits/stdc++.h> using namespace std; signed main() { unsigned long long a, b; cin >> a >> b; if (a < b || (a % 2 != b % 2)) { cout << -1 << endl; return 0; } unsigned long long x = (a - b) / 2; unsigned long long y = x + b; cout << x << << y << endl; return 0...
#include <bits/stdc++.h> using namespace std; long long mulMod(long long a, long long b, long long m = 1000000007) { long long x = 0, y = a % m; while (b > 0) { if (b % 2 == 1) x = (x + y) % m; y = (y * 2) % m; b /= 2; } return x % m; } long long expMod(long long b, long long e...
#include <bits/stdc++.h> using namespace std; double A[100], B[100]; int main() { int n, V; cin >> n >> V; double S = 0.0; for (int i = 0; i < n; i++) { cin >> A[i]; S += A[i]; } for (int i = 0; i < n; i++) A[i] *= V / S; double MIN = 1.0; for (int i = 0; i < n; i++) { ...
// 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 Feb 20 14:24:11 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int main() { int ans = INT_MAX; char W[100001]; scanf( %100000s , W); string s = W, t = Bulbasaur ; map<char, int> I, M; for (char ch : t) ++I[ch]; for (char ch : s) ++M[ch]; for (auto p : I) { ans = min(ans, M[p.first] / p.second)...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_dtl_flps.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 an...
/* * 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 "hi_read_tx.v" /* pck0 - input main 24Mhz clock (PLL / 4) [7:0] adc_d - input data from A/D converter shallow_modulation - modulation type pwr_lo - output to coil drivers (ssp_clk / 8) adc_clk - output A/D clock signal ssp_frame - output SSS frame indicator (goes high while the 8 bits are shift...
#include <bits/stdc++.h> using namespace std; const long long N = 5100; long long n, s, t, x[N], a[N], b[N], c[N], d[N], w[N]; long long dp[N][N]; inline void print(long long a[]) { for (long long i = 1; i <= n; i++) printf( %lld , a[i]); printf( n ); } inline long long read() { long long f ...
#include <bits/stdc++.h> using namespace std; long long bigmod(long long a, long long p) { long long ret = 1; while (p > 0) { if ((p & 1)) ret = (ret * a) % 998244353LL; p >>= 1; a = (a * a) % 998244353LL; } return ret; } long long modinverse(long long a) { return bigmod(a, 998...
#include <bits/stdc++.h> using ll = long long; using ld = long double; using namespace std; void debugi(vector<int>& vec) { int n = (int)vec.size(); for (int i = 0; i < n; i++) { cout << vec[i] << ; } cout << endl; } void debugd(vector<long double>& vec) { int n = (int)vec.size(...
/** * 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() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; vector<long long int> v(n, 0); priority_queue<pair<long long int, pair<long long int, long long int>>> pq; pq.push({n, {0, n - 1}}); long lon...
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; signed main() { long long n; cin >> n; vector<long long> a(n); vector<long long> ruio(n + 1, 0); vector<long long> ruit(n + 1, 0); long long ro = 0; long long rt = 0; for (long long i = 0; i < n; i++) { ci...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** * 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...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Load/Store unit //// //// //// //// This file is part of the OpenR...
///////////////////////////////////////////////////////////////////// //// Author: Zhangfeifei //// //// //// //// Advance Test Technology Laboratory, //// //// Institute of Computing Technol...
// file: clk_wiz_0.v // // (c) Copyright 2008 - 2015 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...
/*===========================================================================*/ /* Copyright (C) 2001 Authors */ /* */ /* This source file may be used and distributed without restriction provided */ ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const unsigned long long base = 2333; const int maxn = 1e2 + 55; const int maxm = 1e4 + 50; const int maxv = 1e6 + 5; const int mod = 51123987; long long Cal(string s, long long p) { long long len = s.size(); long long sum...
#include <bits/stdc++.h> using namespace std; int alpha[26] = {0}, dig[105] = {0}; long long int gcd(long long int a, long long int b) { if (a == 0) return b; return gcd(b % a, a); } long long int lcm(long long int a, long long int b) { return ((a * b) / gcd(a, b)); } bool isPrime(int n) { ...
/******************************************************************************/ /* PCIe test module Ryohei Kobayashi 2015.07.12 */ /******************************************************************************/ `default_nettype none /***** An SRL-based FIFO ...
/* Copyright (C) 2014 Adapteva, Inc. Contributed by Fred Huettig <> 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) any later versio...
/** * 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) 2016 Univ. of Nebraska - Lincoln // // 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 ve...
#include <bits/stdc++.h> using namespace std; long long ax, ay, bx, by, cx, cy; void check(long long xx, long long yy) { if (cx == 0 && cy == 0) { if (xx == 0 && yy == 0) { cout << YES ; exit(0); } else return; } if ((cx * (yy)-cy * (xx)) % (cx * cx + cy * cy) != 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; bool ask(int val) { cout << ? << val + 1 << endl; string resp; cin >> resp; return resp[0] == Y ? true : false; } void fix() { cout << R << endl; } int main() { int n, k; cin >> n >> k; vector<bool> check(n + 1, 0); int block...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:14:09 03/08/2014 // Design Name: // Module Name: obc1 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision: // ...
#include <bits/stdc++.h> using namespace std; char inc(char &c) { char ret = c; if (c == z ) c = a ; else ++c; return ret; } int main() { int n; cin >> n; char t[4][n]; char c = a ; t[0][0] = t[1][0] = inc(c); for (int i = 1; i < n; ++i) { if (i % 2 =...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000 ) using namespace std; int n; char s[2000][2001]; bool A[2000][2000]; int C[2][2000]; int Z[2][2000]; bool F(int x, int y) { return (x >= 0 && y >= 0 && x < n && y < n); } int main() { cin >> n; for (int(i) = (0); (i) < (n); ++...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; int o = 0, s = 0; for (int i = 0; i < n; i++) { cin >> a[i]; s = s + a[i]; if ((a[i] % 2) != 0) { o++; } } if ((s % 2) == 0) { cout << n - o; } else { cou...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; const int MAXM = 1000005; const int MOD = 1000000007; const int MAMOD = 998244353; const int INF = 0x3f3f3f3f; const long long LLINF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1.0); const double EPS = 1e-8; int a[1005], color[...
#include <bits/stdc++.h> using namespace std; typedef long double ld; const long long inf = 1100000000000000000; #define maxn 1000005 #define mod 1000000007 //998244353 #define int long long #define PB push_back #define eb emplace_back #define all(c) (c).begin(),(c).end() #define pii pair <int,i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:51:19 05/03/2016 // Design Name: // Module Name: uart_tx // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module fifo_8_to_32 #( parameter DEPTH = 1024 ) (...
// 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 Jun 05 00:51:00 2017 // Host : GILAMONSTER running 64-bit major release (...
//////////////////////////////////////////////////////////////////////////////// // // // Copyright 2006, 2007 Dennis van Weeren // // ...
/** * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_ffu_vis.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...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; char s[N]; int n, m, t[N]; int a[N * 4], b[N * 4], ab[N * 4], ba[N * 4], aba[N * 4], tag[N * 4]; void pushup(int now) { a[now] = max(a[(now << 1)], a[(now << 1 | 1)]); b[now] = min(b[(now << 1)], b[(now << 1 | 1)]); ab[now] =...
/** * 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...
#include <bits/stdc++.h> using namespace std; const int p = 1000000007; int K; struct Ma { int g[31][31]; Ma() { memset(g, 0, sizeof(g)); } int* operator[](int x) { return g[x]; } Ma operator*(const Ma& b) const { Ma res; for (int i = 0; i <= K; i++) for (int k = 0; k <= K; k...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const double INF = 1e6; const double PI = atan2(0, -1); const int maxn = 550; inline int sgn(double x) { if (fabs(x) < EPS) return 0; return x < 0 ? -1 : 1; } inline int iseq(double x, double y) { return sgn(x - y) == 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...
// vim:set shiftwidth=3 softtabstop=3 expandtab: //`include "register.v" module int_alu(out,a,b,instr,c); // 32 bit integer ALU input[32:0]a,b; // 32 bit input registers input[32:0]instr; // 32 bit instruction register output[32:0]out; // 32 bit output register reg[32:0]out;...
module sdram_tb (); reg clk, rst; wire sdram_clk; wire sdram_cle; wire sdram_cs; wire sdram_cas; wire sdram_ras; wire sdram_we; wire sdram_dqm; wire [1:0] sdram_ba; wire [12:0] sdram_a; wire [7:0] sdram_dq; wire [24:0] addr; wire rw; wire [31:0] data_in, data_out...
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a >> b; if (a == b) { cout << a << n ; } else cout << 1 n ; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a[150], i, j, best, ans = 10000; cin >> n; for (i = 0; i < n; ++i) cin >> a[i]; for (i = 1; i < n - 1; ++i) { best = 0; for (j = 1; j < n; ++j) if (j != i) best = max(best, a[j] - a[j - 1]); else ...
#include <bits/stdc++.h> typedef struct { double x; double y; double r; } circle; typedef struct { double x; double y; } pt; int x[3]; int y[3]; int r[3]; pt np(double x, double y) { pt q; q.x = x; q.y = y; return q; } double abs_d(double d1) { if (d1 > 0) ret...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; int main() { int x1, y1, x2, y2; while (~scanf( %d%d%d%d , &x1, &y1, &x2, &y2)) { long long x = x2 - x1 + 1; long long y = y2 - y1 + 2; long long s = x * y / 2 - x / 2; printf( %lld n , s); } }
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> void chkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> void chkmax(T1 &x, T2 y) { if (x < y) x = y; } inline void debug(int x) { fprintf(stderr, ycx has aked ioi %d times n , x); } na...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long int modpow(long long int a, long long int n, long long int temp) { long long int res = 1; while (n > 0) { res = (res * res) % temp; if (n & 1) res = (res * a) % temp; n /= 2; } return res; } long long int gcd(long long int...
//Legal Notice: (C)2014 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 associate...
/** * 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...
// (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...
// (c) Copyright 1995-2016 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 ...
`timescale 1ns / 1ps module ID_Ex(clk,Reset,Enable, Opcode,BSelector,Rd,RValue1,RValue2,ImmValue,MemRD,memWD,RegWrite,OPCODE,BSELECTOR,RD,RVALUE1,RVALUE2,IMMVALUE,MEMWD,MEMRD,REGWRITE); input wire clk, Reset, Enable; input [4:0] Opcode; input [0:0] BSelector; input [4:0] Rd; input [31:0] RValue1,RValue2; input [...
#include <bits/stdc++.h> using namespace std; vector<vector<long long>> gr; vector<bool> used; vector<long long> tin, up; const long long Nmax = 400000; long long p[Nmax]; long long sz[Nmax]; long long timer = 0; long long diametr(long long u, vector<vector<long long>> gr) { queue<long long> q; ...
#include <vector> #include <algorithm> #include <queue> #include <iostream> #include <string> #include <stack> #include <map> #include <fstream> #include <random> #include <iomanip> #include <set> #include <cmath> #include <cassert> #include <unordered_set> #include <unordered_map> using ...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 // Date : Fri Nov 2 15:01:49 2018 // Host : graviton running 64-bit Debian GNU/Linux 7....
#include <bits/stdc++.h> using namespace std; int p2[203]; int p5[203]; int dpcur[203][5003][2]; int dpnxt[203][5003][2]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { long long int x; cin...
// vim:set shiftwidth=3 softtabstop=3 expandtab: /** * MIPS * basic (static) branch prediction: don't expect jumps. Possible later upgrade to saturating counter. * pipeline * OoO? */ `define BYTESIZE 8 `define WORDSIZE 4 `define BITNESS 32 //`include "alu.v" module fpu(); //floating point optimised alu endmodul...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2011, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WITHOUT THE // EXPRESSED WRITTEN CONSENT OF VIPcore Group // // VIPcore : http://soc.fudan.edu.cn/vip // IP Owner : Y...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int x = abs(a - b); if (x % 2 == 0) { x /= 2; cout << x * (x + 1) << endl; } else { x /= 2; cout << x * (x + 1) + x + 1 << 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 la...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 10; int rd() { int x = 0, w = 1; char ch = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + (ch ^ 48); ch = getchar(); } ret...
module vga640x480ice(input clk, // system clock input clk25mhz, input rst, input [15:0] sram_in, output [17:0] sram_adr_vga, output reg data_rq_vga, inpu...
#include <bits/stdc++.h> using namespace std; int N, M, T; int A[20000]; int rans; vector<int> ans; set<pair<int, int>> online; multiset<pair<int, int>> events; bool solve() { bool good = false; for (int i = 0; i < N; i++) events.insert({A[i], -1}); while (!events.empty()) { int t = ev...
#include <bits/stdc++.h> using namespace std; const long long N = 3e5 + 10, M = 2097152 + 10; long long n, x, ans, ar[N], mark[M][2]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (long long i = 0; i < n; i++) cin >> ar[i]; mark[0][1]++; for (long long i = 0; i < n;...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; char def = a ; int pos = 0; string ans = ; for (int i = 0; i < n; i++) { ans += def + pos; pos = (pos + 1) % k; } cout...
#include <bits/stdc++.h> using namespace std; int main() { string s; int i, cnt = 0, p = 0, n; cin >> n; cin >> s; for (i = 0; i < n; i++) if (s[i] == 0 ) cnt++; else p++; if (p > 0) { cout << 1; for (i = 0; i < cnt; i++) cout << 0; cout << endl...
/* * Copyright 2012, Homer Hsing <> * * 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 ...
/* * These source files contain a hardware description of a network * automatically generated by CONNECT (CONfigurable NEtwork Creation Tool). * * This product includes a hardware design developed by Carnegie Mellon * University. * * Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University * * ...
/** * 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 PS_flops_rd_ex_lsu( in_vector_source_a, in_vector_source_b, in_scalar_source_a, in_scalar_source_b, in_imm_value0, in_opcode, in_lddst_stsrc_addr, in_rd_en, in_wr_en, in_wfid, in_instr_pc, in_lds_base, in_exec_value, out_vector_source_a, out_vector_source_b, out_scalar_source_a, ...
#include <bits/stdc++.h> using namespace std; int mp[505][505], f[505]; void push(int n) { for (int i = 1; i <= n; i++) cout << f[i] << ; cout << endl; } int main() { int n, m, i, j, Q, sum, x, y; while (scanf( %d%d%d , &n, &m, &Q) != EOF) { memset(f, 0, sizeof(f)); for (i = 1; ...
#include <bits/stdc++.h> using namespace std; int a[2001], b[2001], n, k, len = 0, ans = 0, res = 0; void solve() { scanf( %d %d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , a + i); } sort(a, a + n); for (int i = 0; i < n; i++) { if (a[i] + k <= 5) { len++; } ...
#include <bits/stdc++.h> using namespace std; const int mx = 5e5 + 10; const double eps = 1e-9; const int inf = 1e9; char a[mx]; multiset<char> ms; int main() { scanf( %s , a); int n = strlen(a); int mn = a[0] - a ; printf( Mike n ); for (int i = 1; i < n; i++) { if (a[i] - a ...
// TimeHoldOver_Qsys_nios2_gen2_0.v // This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 16.0 222 `timescale 1 ps / 1 ps module TimeHoldOver_Qsys_nios2_gen2_0 ( input wire clk, // ...
#include <bits/stdc++.h> using namespace std; int main(void) { int x1, y1, x2, y2; scanf( %d%d%d%d , &x1, &y1, &x2, &y2); int res = abs(x1 - x2) + 1 + (x1 == x2); res += abs(y1 - y2) + 1 + (y1 == y2); printf( %d n , res * 2); }
#include <bits/stdc++.h> using namespace std; long long P[200020]; long long n, m; long long Mod = 998244353; long long Power(long long a, long long b) { if (b < 1) return 1; long long Tmp = Power(a, b / 2); Tmp = Tmp * Tmp % Mod; if (b & 1) Tmp = Tmp * a % Mod; return Tmp; } long long...