text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, j; scanf( %d %d , &n, &m); for (i = 0; i < n / 2; i++) { for (j = 0; j < m; j++) { printf( %d %d n%d %d n , i + 1, j + 1, n - i, m - j); } } if (n % 2 == 1) { for (j = 0; j < m / 2; j++) { p...
#include <bits/stdc++.h> using namespace std; int search(long long int *array, int start_idx, int end_idx, long long int search_val) { if (start_idx == end_idx) return array[start_idx] <= search_val ? start_idx : -1; int mid_idx = start_idx + (end_idx - start_idx) / 2; if (search_val ...
/** * 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 <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; void solve() { long long n; cin >> n; if (n < 6) cout << -1 << endl; else { cout << 1 2 n2 3 n2 4 n1 5 n1 6 n ; for (long long i = 7; i <= n; i++) { cout << 2 << << i << endl; } ...
#include <bits/stdc++.h> using namespace std; long long n, k; vector<vector<long long>> ft(12, vector<long long>(100005, 0)); void add(long long kk, long long ind, long long val) { while (ind <= n) { ft[kk][ind] += val; ind += ind & -ind; } } long long sum(long long kk, long long ind) { ...
#include <bits/stdc++.h> using namespace std; template <typename T> void out(T x) { cout << x << endl; exit(0); } const int maxn = 2000 + 7; int n; long double p; int t; long double dp[maxn][maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >>...
/** * 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...
/// /// Camera configuration /// -------------------- /// /// This module configures the camera sensor through its control registers. /// For in this way control and configure: the exposition time, the resolution /// and the frame rate. /// /// .. figure:: camera_config.png /// /// Camera configuration block /// ///...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:25:47 05/08/2012 // Design Name: cls_spi // Module Name: G:/Projects/s6atlystest/cls_spi_tb.v // Project Name: s6atlystest // Target Device: // Tool versions: ...
/* * 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; struct e { int a, b; }; e p[100005]; int n, k; bool use[100005]; priority_queue<int, vector<int>, std::greater<int> > Q; bool criteriu(e a, e b) { return a.b > b.b; } long long af; int main() { scanf( %d %d , &n, &k); for (int i = 1; i <= n; ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; stack<char> stk; int cnt = 0; for (int i = s.size() - 1; i >= 0; i--) { if (stk.empty()) stk.push(s[i]); else { if (stk.top() == s[i]) { cnt++; stk.pop(); } else...
module step_ex_cpf(clk, rst_, ena_, rdy_, reg_id, r0_din, r0_we_, r0_dout, r1_dout, r2_dout, r3_dout, r4_dout, r5_dout, fl_dout, pc_dout); input clk; input rst_; input ena_; output rdy_; input[3:0] reg_id; output[7:0] r0_din; output r0_we_; input[7:0] r0_dout, r1_dout, r2_dout, r...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, j = 0; cin >> n; int a[n], b[n]; pair<int, int> s[n]; for (auto &i : s) cin >> i.first, i.second = j++; sort(s, s + n); map<int, int> mp; for (int i = 0; i < n; i++) mp[s[i].sec...
#include <bits/stdc++.h> using namespace std; namespace io { const int __SIZE = (1 << 21) + 1; char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof; inline void flush() { fwrite(obuf, 1, oS - obuf, stdout), ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ `timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit...
/* verilator lint_off STMTDLY */ module dv_ctrl_local(/*AUTOARG*/ // Outputs nreset, clk1, clk2, start, // Inputs dut_active, stim_done, test_done ); parameter CFG_CLK1_PERIOD = 10; parameter CFG_CLK1_PHASE = CFG_CLK1_PERIOD/2; parameter CFG_CLK2_PERIOD = 100; parameter CFG_CLK2_PHASE =...
/** * 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 double eps = 0.001; const int mod = 1000000007; int main() { int n, pos, l, r, ans; scanf( %d%d%d%d , &n, &pos, &l, &r); if (l == 1 && r == n) ans = 0; else if (l == 1) ans = abs(pos - r) + 1; else if (r == n) ans = abs(po...
/* Copyright (c) 2017 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_MinMax.v // Created: 2014-08-25 21:11:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------...
/** * Testbench file for components-shiftreg.v * * Verilib - A Verilog HDL development framework * Copyright (c) 2014, Patrick Dear, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the F...
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; if (k % 2 != 0) { cout << -1 ; return 0; } for (int i = 0; i < k; i++) { for (int j = 0; j < k; j++) { for (int t = 0; t < k; t++) { if (i % 2 == 0) { if ((j % 4 <= 1 && t...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2010 Xilinx, 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 // //...
/** * 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 2018-2022 F4PGA 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
#include <bits/stdc++.h> template <typename T> void scan(T &x) { x = 0; bool _ = 0; T c = getchar(); _ = c == 45; c = _ ? getchar() : c; while (c < 48 || c > 57) c = getchar(); for (; c < 48 || c > 57; c = getchar()) ; for (; c > 47 && c < 58; c = getchar()) x = (x << 3) + (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...
//************************************************************************* // > ÎļþÃû: adder_display.v // > ÃèÊö £º¼Ó·¨Æ÷ÏÔʾģ¿é£¬µ÷ÓÃFPGA°åÉϵÄIO½Ó¿ÚºÍ´¥ÃþÆÁ // > ×÷Õß : LOONGSON // > ÈÕÆÚ : 2016-04-14 //************************************************************************* module adder_display( /...
/* * 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 MAXN = 3e4, SQN = 3e2; map<int, int> dst_idx, idx_dst; int n, d, dp[MAXN + 3][SQN + 3], a[MAXN + 3], max_idx; int fazdp(int idx, int li) { if (dp[idx][li] != -1) return dp[idx][li]; int di = idx_dst[li]; int ret = 0; for (int i = -1; i <=...
#include <bits/stdc++.h> using namespace std; const int N = 3e3 + 1; struct node { int w, x, y, z; }; queue<int> q; vector<int> g[N], rg[N]; int d[N][N], rd[N][N], vis[N]; vector<pair<int, int>> fg[N], frg[N]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ...
#include <bits/stdc++.h> using namespace std; int m, n, arr[2000][2000], temp[2000][2000]; char ctrl(int i) { for (int j = 1; j <= n; j++) if (arr[i][j] and arr[i][j] != temp[i][j]) return 0; return 1; } char solve(int a, int b, int c, int d, int ttt = 0) { if (ttt) ttt = 3; for (int i =...
#include <bits/stdc++.h> using namespace std; int n, a[1005]; long long int p[1005], f[1005], d; long long int power(long long int a, long long int b) { if (b == 0) return 1; if (b == 1) return a % 998244353; long long int c = power(a, b / 2); if (b & 1) return (((c * c) % 998244353) * a) ...
module main; reg src; reg clk; wire dst0, dst1; test #(.parm(0)) test0 (.dst(dst0), .src(src), .clk(clk)); test #(.parm(1)) test1 (.dst(dst1), .src(src), .clk(clk)); //Note: For Modelsim compatibility do instantiation as: //test #(.parm(2'b10)) test0 (.dst(dst0), .src(src), .clk(clk)); //test #(.parm(2'b11)...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:55:33 09/09/2014 // Design Name: // Module Name: sevensegdecoder // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies...
#include <bits/stdc++.h> using namespace std; int n; int a[300005] = {0}; int c1 = 0, c2 = 0, p1 = 0, p2 = 0; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; int maxn = -1; for (int i = 1; i <= n; i++) { if (c1 == 0) { p1 = i; c1 = a[i]; } else if (...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:200000000 ) const double EPS = 1E-9; const int INF = 1000000000; const long long INF64 = (long long)1E18; const double PI = 3.1415926535897932384626433832795; const int NMAX = 310000; set<pair<int, int> > q[3][3]; int a[NMAX...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2017 by Wilson Snyder. module t (/*AUTOARG*/ // Outputs i65, j65, i33, j33, i30, j30, q65, r65, q33, r33, q30, r30, w65, x65, w33, x33, w30, x30, // Inputs a, a40, a70 ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 2e5 + 8, inf = 1e18 + 9, mod = 1e9 + 7; char s[maxn]; long long n, m; void solve() { long long i, j, ans = 1; cin >> n >> (s + 1); for (i = 2; i <= n; i++) if (s[i] != s[i - 1]) ans++; cout << min(ans + 2, n) << 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...
/* * 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 long long N = 1e5, OO = 1e14; const int di[] = {1, -1, 0, 0}; const int dj[] = {0, 0, 1, -1}; long long TC, n, m, k, a, b, c, cnt, u, mx, mn, ans, arr[N]; bool f, vis[N], mark[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> TC; ...
#include <bits/stdc++.h> using namespace std; vector<pair<pair<int, int>, pair<int, int> > > way[222222]; queue<int> turn; bool was[222222]; int i, n, m, ans[222222], cost[222222]; int main() { cin >> n >> m; for (i = 1; i <= m; i++) { int a, b, c; cin >> a >> b >> c; cost[a] += c;...
#include <bits/stdc++.h> using namespace std; bool exitInput = false; int ntest = 1, itest = 1; const char* directions[4] = { NE , SE , SW , NW }; const long long Mod = 1000000000LL + 7; const int maxn = 100 + 2; const int maxv = 1000000 + 5; const int maxe = 600000 + 5; const int root = 1; int a...
#include <bits/stdc++.h> using namespace std; vector<int> G[((int)2e5 + 10)]; int dis[((int)2e5 + 10)]; int n; int ans = 0; void dfs(int f, int son, int d) { int flag = 0; dis[son] = d; for (int i = 0; i < G[son].size(); i++) { if (G[son][i] == f) continue; dfs(son, G[son][i], d + 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...
#include <bits/stdc++.h> using namespace std; bool condition(int year) { int year_arr[4]; int boo; for (int i = 3; i >= 0; i--) { year_arr[i] = year % 10; year = year / 10; } if (year_arr[0] == year_arr[1] || year_arr[0] == year_arr[2] || year_arr[0] == year_arr[3] || year_ar...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_b_e // // Generated // by: wig // on: Wed Jun 7 16:54:20 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta -bak ../../bitsplice.xls // // !!! Do not edit this file! Autogenerated by ...
/** * 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> const int MAXN = 200005; int n, m, tot, a[MAXN], b[MAXN], pa[MAXN], pb[MAXN], tr[MAXN], ans[MAXN * 10]; bool tag[MAXN * 10], used[MAXN * 10]; template <typename T> inline void read(T &x) { int fl = 0, ch; while (ch = getchar(), ch < 48 || 57 < ch) fl ^= !(ch ^ 45); x = (ch...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, i; long long a, b; cin >> n; i = a = 0, b = 1000000001; int arr[n]; while (i < n) { cin >> arr[i]; i++; } i = n - 1; while (i >= 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int sum = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } int res = 0; for (int i = 0; i < n; i++) { if ((sum - arr[i]) % 2 == 0) res++; } cout << res <<...
/******************************************************* * File Name : hdl/ks26.v * Module Name : Karatsuba Multiplier * Author : Chester Rebeiro * Institute : Indian Institute of Technology, Madras * Creation Time : * Comment : Automatically generated from ks.c *********************************...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f;...
#include <bits/stdc++.h> using namespace std; struct Point { int num; int next[3001]; int count; }; Point a[3001]; int dis[3001]; int p[3001]; int cir[3001]; int cir1[3001]; int f(int n) { int i, num = 0, d = 1; loop: while (1) { num = 0; for (i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; vector<long long> v[200010]; vector<long long> traversal; long long cnt; long long color[200010]; long long start[200010]; long long enddd[200010]; void dfs(long long curr) { start[curr] = cnt; traversal.push_back(curr); cnt++; for (int i = 0...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; using vll = vector<long long>; using vii = vector<pair<int, int>>; const int N = 105; int matrix[N][N]; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); for (int i =...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015 // Date : Tue Jun 21 04:38:22 2016 // Host : jalapeno running 64-bit unknown // Command ...
#include <bits/stdc++.h> using namespace std; const int max_n = 1011, inf = 1000111222; int n, a[max_n][max_n], x[max_n]; int main() { scanf( %d , &n); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { scanf( %d , &a[i][j]); } } long long val = 1LL * a[0][1] * a[0][...
#include <bits/stdc++.h> using namespace std; int a[200010]; struct seg { int val, idx; } tree1[600010], tree2[600010]; void build(int node, int s, int e) { if (s > e) return; if (s == e) { tree1[node].val = a[s]; tree1[node].idx = s; tree2[node].val = a[s]; tree2[node].idx...
#include <bits/stdc++.h> int main() { int n; long long x; scanf( %d , &n); x = (n - 2); x = x * x; printf( %I64d , x); return 0; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Case Western Reserve University // Engineer: Matt McConnell // // Create Date: 22:14:00 09/09/2017 // Project Name: EECS301 Digital Design // Design Name: Lab #4 Project // Module Name: ...
#include <bits/stdc++.h> using namespace std; vector<long long int> facts; vector<long long int> inv_facts; long long int c(long long int n, long long int p) { if (p < 0 || n < p) return 0; return (facts[n] * inv_facts[p]) % 1000000007 * inv_facts[n - p] % 1000000007; } long long int pow_mod(long lo...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo_mixed_widths // ============================================================ // File Name: video_fifo.v // Megafunction Name(s): // dcfifo_mixed_widths // // Simulation Library Files(s): // altera_mf // ======...
#include <bits/stdc++.h> using namespace std; const long long int p = 1e9 + 7; const int N = 1e5 + 1; long long int fact[N]; long long int ncr[N]; long long int n_1cr[N]; void factorial() { fact[0] = fact[1] = 1; for (int i = 2; i < N; i++) { fact[i] = i * fact[i - 1]; fact[i] %= p; ...
#include <bits/stdc++.h> using namespace std; long long dp[1000006][2]; long long pre[1000006][2]; void chkMinLog(long long& goal, long long t1, bool t2, bool curr) { if (dp[t1][t2] > goal) { dp[t1][t2] = goal; pre[t1][t2] = curr; } } void solve() { long long n; cin >> n; vec...
#include <bits/stdc++.h> using namespace std; string s; bool mark = false; int main() { cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 0 && mark == false) { mark = true; continue; } if (mark == false && i == s.size() - 1) return 0; cout << s[i]; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; const int sz = 10; map<int, int> mp[11]; int n, k; unsigned long long a[maxn], ans; unsigned long long fac[13]; int main() { fac[0] = 1; for (int i = 1; i <= 10; i++) fac[i] = 10LL * fac[i - 1]; scanf( %d%d , &n, &k); ...
///////////////////////////////////////////////////////////////////// //// //// //// JPEG Run-Length encoder //// //// //// //// 1) Retreive zig-zag-ed samples (st...
#include <bits/stdc++.h> using namespace std; int t, n, freq[201][212345]; int main() { scanf( %d , &t); while (t--) { scanf( %d , &n); vector<int> pos[201]; for (int i = 0; i < 201; ++i) for (int j = 0; j <= n; ++j) freq[i][j] = 0; for (int x, i = 1; i <= n; ++i) s...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n, sum1 = 0, res1 = 0, last = 0; bool flag = true; cin >> n; unordered_map<long long int, long long int> m; vector<pair<long long int, long long i...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, mx = 2, j; cin >> n; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; if (n == 1) cout << 1 ; else if (n == 2) cout << 2 ; else { for (i = 2; i < n;) { int x = 0; for (j = i; j < n; j++...
module top ( output wire MOSI, output wire CSB, output wire DRCK1, output wire dac_cs, output wire amp_cs, output wire ad_conv, output wire sf_ce0, output wire fpga_init_b, input MISO ); wire CAPTURE; wire UPDATE; wire TDI; wire TDO1; reg [47:0] header; reg [1...
#include <bits/stdc++.h> using namespace std; long long m, loc, t; long long now; class SegTree { private: long long F2(long long k) { return 1 << (long long)ceil(log2(k)); } vector<long long> seg; void Merge(long long cur) { seg[cur] = seg[2 * cur] + seg[2 * cur + 1]; } public: SegTree...
// 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 22 13:46:37 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long getres(long long n) { if (n == 0) { return 0; } vector<long long> now; for (long long i = 0;; i++) { long long t = pow(2, i); if (t <= n) { n -= t; now.push_back(t); if ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 1000000 + 5; const long long DIFF = 2000; const long long mod = 1000000000 + 7; long long dp[DIFF + 5][DIFF + 5]; char s[maxn]; int main() { dp[0][0] = 1; for (int i = 1; i <= DIFF; dp[i][0] = dp[i - 1][1], i++) for (int 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...
/** * 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 commutation( clk, enable_i, reset_i, advance_i, direction_i, break_i, align_i, state_o ); input wire clk, enable_i, reset_i, advance_i, direction_i, break_i, align_i; reg[2:0] state_number; output wire[3:0] state_o; reg[3:0] state_table[7:0]; always @(posedge clk) begin if (reset_i) begin ...
module io1_sub( /*AUTOARG*/ // Outputs sec_out, lower_out, // Inouts sec_io, lower_io, // Inputs sec_ina, lower_ina ); /*AUTOINPUT*/ // Beginning of automatic inputs (from unused autoinst in...
#include <bits/stdc++.h> using namespace std; vector<pair<double, pair<int, int> > > s; int n, x; pair<double, pair<int, int> > tmp; signed main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (register int i = 1; (1 < n) ? (i <= n) : (i >= n); i += (1 < n) ? 1 : (-1))...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, i, j, k, l, p = 0, q, x, y, z; scanf( %lld %lld %lld %lld , &n, &m, &k, &l); x = l * 2; x = min(x, n); i = x / 2; for (; i >= 0; i--) { x = i * 2; x = n - x; x = min(x, k); for (j = x; j >=...
#include <bits/stdc++.h> using namespace std; int putere(long long int a, long long int b) { if (b == 0) { return 1; } else { if (b == 1) return a % 1000000007; else { long long int r; r = putere(a, b / 2); r = (r * r) % 1000000007; if (b % 2 == 0) ...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; struct Hash { const long long int mod = 1791791791; const long long int base = 255; vector<long long...
`include "defines.v" module RouteCompute( input `control_w control_in, input `addrx_w addrx, input `addry_w addry, input `addrx_w addrx_max, input `addry_w addry_max, output `rmatrix_w rmatrix); // Break out control signals wire ...
#include <bits/stdc++.h> using namespace std; const int N = 333; long long n, ans[N], a[N][N], pos[N]; long long absv(long long val) { if (val < 0) val *= -1; return val; } int main() { std::ios::sync_with_stdio(false); cin >> n; for (int i = 0; i <= n; i++) { for (int j = 0; j < n...
`timescale 1 ns / 100 ps module top ( ); reg clk; reg rst; reg start_i ; reg [31:0] ray_adr_i ; reg [31:0] root_adr_i ; reg [2:0] dir_mask_i ; reg [31:0] tx0_i ; reg [31:0] ty0_i ; reg [31:0] tz0_i ; reg [31:0] tx1_i ; reg...
/* * Copyright (c) 2000 Guy Hutchison () * * This source code is free software; you can redistribute it * and/or modify it in source code form 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) * ...
#include <bits/stdc++.h> int main() { float d, l, v1, v2, y, z, p, q, i, j; scanf( %f %f %f %f , &d, &l, &v1, &v2); float x = (l - d) / (v1 + v2); printf( %f n , x); }
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); int a[n + 2]; a[0] = 0; for (int i = 1; i < n; i++) { scanf( %d , &a[i]); } for (int i = 1; i < n; i++) { a[i] = a[i - 1] + a[i]; } int x, y; scanf( %d%d , &x, &y); printf( %d ,...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; const long long maxu = 200005; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long i, j, k = 0, n, t = 1, m, l = 0; cin >> t; while (t--) { cin >> n; long long a[n...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << 1 << endl; } else if (n % 2 == 0) { cout << n / 2 << endl; } else if (n % 2 != 0) { cout << n / 2 + 1 << endl; } return 0; }