text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long a, b, x; int n; int main() { scanf( %d , &n); scanf( %lld%lld , &a, &b); while (n--) { scanf( %lld , &x); printf( %lld , ((x * a) - b * ((x * a) / b)) / a); } return 0; }
#include <bits/stdc++.h> using namespace std; unsigned long long pow_of_two[10000]; int create() { unsigned long long i = 0; unsigned long long num = 1; while (num <= INT_MAX and num >= 0) { num = pow(2, i); pow_of_two[i] = num; i++; } } int main() { int n; cin >> n; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); long long n; cin >> n; long long a[n]; map<long long, long long> m, ans; vector<long long> v; for (long long i = 0; i < n; i++) { cin >> a[i]; if (m[a[i]] == 0 && a[i] <= n) { m[a...
#include <bits/stdc++.h> using namespace std; int main() { int t, n, x, y; scanf( %d , &t); while (t--) { scanf( %d%d%d , &n, &x, &y); int d, dif = y - x; for (int i = 1; i <= dif; i++) { if (dif % i == 0 && (dif / i <= n - 1)) { d = i; break; } ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_20_64.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ================================...
// (C) 1992-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 simulati...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, countt = 0, counts = 0, maxi = 0; cin >> n >> k; long long int a[n]; for (long long int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] == -1) counts++; else countt++; } for (long lon...
`ifndef SHIFTER_V `define SHIFTER_V `include "mux.v" `ifndef WIDTH `define WIDTH 32 `endif `ifndef SHIFT_WIDTH `define SHIFT_WIDTH 5 `endif `ifndef OPS `define OPS 2 `endif `define LEFT_SHIFTA 2'b00 `define LEFT_SHIFTL 2'b01 `define RIGHT_SHIFTA 2'b10 `define RIGHT_SHIFTL 2'b11 module shifter( input[`WIDTH - ...
#include <bits/stdc++.h> int main() { long int n, m; int t; scanf( %d , &t); while (t--) { scanf( %ld%ld , &n, &m); if (n == 1) printf( 0 n ); else if (n == 2) { printf( %ld n , m); } else { printf( %ld n , 2 * m); } } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using lpair = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll INF = 8e18; void print() {} template <class H, class... T> void print(H&& h, T&&... t) { cout << h << n [sizeof...(t) == 0]; print(forward<T>(t)...); } int main...
#include <bits/stdc++.h> using namespace std; long long int a[200]; int main() { long long int n, ans = 0, m, i, j, x, y; cin >> n >> m; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= m; i++) { cin >> x >> y; long long int ret = 0; for (j = x; j <= y; j++) { ret +...
`timescale 1ns / 1ps module INSTRUCTION_DECODER(input CLK, input [7:0] RXD, input RXD_START, input TXD_DONE, output TXD_ENABLE, output reg MUX_SEL, output reg [9:0] RAM_ADDR, output reg [31:0] TRIG_DATA, output reg TRIG_UPDATE, output reg TRIG_FORCE); /*0x01 SET TRIG CONDITION *0x02 CHECK TRIGGERED *0x03 F...
#include <bits/stdc++.h> using namespace std; int n, m; int xans[200005]; bool pos; vector<pair<int, int> > xoc[200005]; vector<pair<int, int> > V[200005]; int erased[200005]; queue<int> toErase; int sgn(int v) { return abs(v) / v; } vector<pair<int, int> > E[200005]; int vis[200005]; int cycleR...
/* * 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; set<pair<long long, long long> > S; set<pair<long long, long long> >::iterator it; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t, n; for (cin >> t; t--;) { cin >> n; S.clear(); long long a = 1, b = 0, ans ...
#include <bits/stdc++.h> using namespace std; #define int long long bool local=false; int z1; int n; vector <int> a; mt19937 rnd; int med(int x,int y,int z) { vector <int> h={x,y,z}; sort(h.begin(),h.end()); return h[1]; } int query(int u,int v,int w) { cout<< ? <<u+1...
#include <bits/stdc++.h> using namespace std; int main() { string a; int count = 0, c = 0; cin >> a; count = a.size(); for (int i = 0; a[i] != 0 ; i++) { if (a[i] >= A && a[i] <= Z ) c++; } if ((c == count) || ((c == count - 1) && (a[0] >= a && a[0] <= z ))) { for (in...
#include <bits/stdc++.h> using namespace std; long long maxn = -1e18; long long minn = 1e18; long long mod = 1000000007; long long ans = 0; long long cur = 0; long long tong = 0, tong2 = 0; long long cnt = 0; long long k, l; string s; long long n, m, x, y; long long b[100005]; long long was[20...
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 100; const int oo = 1e9 + 7; int N; int H[MAXN]; deque<int> dq; int L[MAXN], R[MAXN], l[MAXN], r[MAXN]; int d[MAXN]; vector<int> G[MAXN]; void Dijkstra(int u) { for (int i = (1), _b = (N + 1); i <= _b; ++i) d[i] = +oo; d[u]...
#include <bits/stdc++.h> using namespace std; inline int read(int f = 1, int x = 0, char ch = ) { while (!isdigit(ch = getchar())) if (ch == - ) f = -1; while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f * x; } const int N = 5e5 + 5; int n, m, f[N], g[N], fs[N], gs[N], f...
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) #pragma comment(linker, /STACK:20000007 ) #pragma GCC optimize( unroll-loops ) const int N = (int)1e6 + 100; const int maxn = (int)1e3 + 100; const int base = (int)1e9; const int mod = (int)1e9 + 7; const int inf = INT_MAX;...
#include <bits/stdc++.h> const int N = 200005; int n, m, b[N]; char a[N], A[N]; int main() { scanf( %d%d%s , &n, &m, a); memset(b, 0x3f, sizeof(b)); for (int i = 0; i < n; i++) { int l = (i - 1 + n) % n, r = (i + 1) % n; if (a[i] == a[r]) { for (int j = l, k = 1; a[j...
#include <bits/stdc++.h> using namespace std; const int NMAX = 300000; const double eps = 1e-6; double sy, a, b; int n, q; double L[NMAX], R[NMAX]; double sum[NMAX]; int dcmp(double x, double y) { if (fabs(x - y) < eps) return 0; if (x > y) return 1; return -1; } int bin_search(double x)...
#include <bits/stdc++.h> using namespace std; int main() { int x, neg, zero; cin >> x; int arr[x]; for (int i = 0; i < x; i++) cin >> arr[i]; sort(arr, arr + x); if (arr[x - 1] <= 0) { cout << 1 << << arr[0] << endl; cout << 2 << << arr[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 law...
#include <bits/stdc++.h> using namespace std; std::vector<int> Edge[510]; std::vector<int> Current[510]; int Right[510]; int Left[510]; int Vis[510]; int N, M; bool dfs(int idx) { if (Vis[idx]) return false; Vis[idx] = 1; for (int i = 0; i < Current[idx].size(); i++) { int v = Current[...
#include <bits/stdc++.h> const int INFI = (1 << 29); const long long INFL = (1LL << 62); using namespace std; void solve() { long long a, n, m; cin >> a >> n >> m; bitset<2010> rain; vector<long long> v(m + 1); vector<pair<long long, long long> > umb(a + 1, {INFL, 0}); for (long long i =...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (k >= (n - 1) * n / 2) { cout << no solution n ; } else { for (int i = 1; i <= n; i++) { cout << 0 << << i << n ; } } return 0; }
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2011 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 // //...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distri...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; long long MOD = 1000000007; struct mi { long long v; explicit operator long long() const { return v; } mi() { v = 0; } mi(long long _v) { v = (-MOD < _v && _v < MOD) ? _v : _v % MOD; if (v < 0) v += MOD; }...
/******************************************************************************* * 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 law...
#include <bits/stdc++.h> using namespace std; template <class T> int getbit(int i, T X) { return (X & (1 << (i - 1))); } template <class T> T onbit(int i, T X) { return (X | (1 << (i - 1))); } template <class T> T offbit(int i, T X) { return (X | (1 << (i - 1)) - (1 << (i - 1))); } tem...
/** * 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...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) struct E { int to; vector<long long> w; }; const long long INF = 1e18; const int N = 3e5 + 5, L = 20; vector<E> g[N]; long long t[N], d[2][2][N][L]; int anc[N][L], tin[N], tout[N]; int timer = 0, n; void deep(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...
#include <iostream> #include <algorithm> #define int long long using namespace std; void solve () { int a, b, c, d; cin >> a >> b >> c >> d; int arr[4] = {a,b,c,d}; sort (arr, arr+4); int max1 = arr[4-1]; int max2 = arr[4-2]; int win1 = max (a, b); int win2 = max (c, d); if (win1 == m...
/** * 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 GS_3032( config_n, // ACEX1K config pins status_n, // conf_done, // cs, // init_done, // clk24in, // 24mhz in clk20in, // 20mhz in clkout, // clock out clksel0, // clock select 0 (1=divide by 2, 0=no divide) clksel1, // clock select 1 (1=clk20in, 0=clk24in) a6,a7,a14,a15, // z80 si...
`include "lo_read.v" /* pck0 - input main 24Mhz clock (PLL / 4) [7:0] adc_d - input data from A/D converter lo_is_125khz - input freq selector (1=125Khz, 0=136Khz) 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...
/** Based on: https://github.com/dirjud/Nitro-Parts-lib-Xilinx */ `timescale 1ps/1ps `default_nettype none module clock_divider_sim #( parameter DIVISOR = 2 ) ( input wire CLK, output reg CLOCK ); integer cnt; initial cnt = 0; always@(posedge CLK) if(cnt == DIVISOR -1) cnt <= 0; else ...
#include <bits/stdc++.h> int n, m, x, tab[11][1001][1001], mx[11][1001][1001], i = 1, j = 1, ij = 1; char a[1001], b[1001], q; inline int max(int a, int b) { if (a >= b) return a; return b; } int main() { scanf( %d %d %d , &n, &m, &x); q = getchar(); while (i <= n) { a[i] = getchar()...
#include <bits/stdc++.h> using namespace std; pair<int, int> stations[200001]; int nxt[200001]; int main() { int d, n, m; scanf( %d%d%d , &d, &n, &m); for (int i = 0; i < m; i++) { scanf( %d%d , &stations[i].first, &stations[i].second); } sort(stations, stations + m); stack<int> s;...
`begin_keywords "1364-2005" /* * Copyright (c) 2005 Stephen Williams () * * 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 Lice...
module main; reg [2:0] ADDR; wire [1:0] data0 = 0, data1 = 1, data2 = 2, data3 = 3; reg [1:0] data; always @* case (ADDR[2:0]) 3'b000: data = data0; 3'b001: data = data1; 3'b010: data = data2; 3'b011: data = data3; default: data = 0; endcase // case(ADDR[2:0])...
////////////////////////////////////////////////////////////////////////////// /// Copyright (c) 2012, Jahanzeb Ahmad /// All rights reserved. /// /// Redistribution and use in source and binary forms, with or without modification, /// are permitted provided that the following conditions are met: /// /// * Redistribu...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { long long r; while (b != 0) { r = a % b; a = b; b = r; } return a; } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } long long fpow(long long n, long long k, int p = ...
/** * 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 solve() { int m, k; scanf( %d %d , &m, &k); vector<int> a(k, 0); vector<int> t(m - 1), r(m - 1, 0); vector<int> last(k, 0); for (int i = 0; i < k; ++i) { scanf( %d , &a[i]); } int free_num = 0; for (int i = 0; i + 1 < m; ++...
#include <bits/stdc++.h> using namespace std; bool Check(long long A, long long B, long long T1, long long T2) { if (!A && !B) return !T1 && !T2; return !((T1 * A + T2 * B) % (A * A + B * B)) && !((T2 * A - T1 * B) % (A * A + B * B)); } int main() { long long X0, Y0, X1, Y1, X2, Y2; c...
/* Copyright (c) 2014-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, distri...
#include <bits/stdc++.h> using namespace std; char c; int s = 0, k = 0, n = 0, x, f = 0; ; int main() { while (cin.get(c)) { if (c == n ) break; switch (s) { case 0: { if (c >= a && c <= z || c >= A && c <= Z || c == _ || c >= 0 && c <= 9 ) { ...
#include <bits/stdc++.h> using namespace std; void solve(long long tc) { long long n, m, k; cin >> n >> m >> k; vector<long long> v(n); for (long long i = (0), ed = (n); i < (ed); ++i) { cin >> v[i]; } sort(v.begin(), v.end()); unsigned long long mx1 = v[n - 1], mx2 = v[n - 2]; ...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Claire Xenia Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21.02.2016 16:25:28 // Design Name: // Module Name: SPI_MASTER // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Re...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1p...
#include <bits/stdc++.h> using namespace std; int grid[201][201]{0}; int main() { string s; cin >> s; int x = 100; int y = 100; grid[x][y] = true; for (auto& it : s) { switch (it) { case L : x--; break; case R : x++; break; ...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property ...
#include <bits/stdc++.h> using namespace std; int const sz = 2 * 1e5; int const oo = 1e9; bool comp(int i, int j) { return i < j; } long long num[1000000], kk[101]; void fill(int n, int m) { long long arr[4] = {0, 1, 2, 3}; int l = 0; num[0] = 1; num[1] = 2; num[2] = 3; for (int i = ...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000007; const long long linf = 1LL << 62; const unsigned long long ulinf = 1ULL << 63; const double eps = 0.000001; const double pi = 3.14159265358979323846; template <class T> T abs(T a) { return a >= 0 ? a : -a; } template <clas...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int MOD = INF + 7; int memo[3000 + 1][100 + 1][100]; int N; vector<int> a, b; int solve(int len, int w, int nouse) { if (len == 0) return 1; if (len < 0) return 0; if (memo[len][w][nouse] != -1) return memo[len][w]...
// 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 : Tue May 30 22:27:54 2017 // Host : GILAMONSTER running 64-bit major release (...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i; double sum = 0, num, av, av1; cin >> n >> k; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } av1 = sum / n; if (av1 >= (k - .5)) { cout << 0 << endl; return 0; } e...
#include <bits/stdc++.h> using namespace std; long long a[200000]; map<long long, bool> mm; int main() { int n, t, k, d; cin >> n >> t >> k >> d; int res0 = 0, res1 = 0, sum0 = 0, sum1 = 0; while (sum0 < n) res0 += t, sum0 += k; for (int i = 1; i <= 10000; i++) { if (i % t == 0) sum1 +...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, i, j; char e, f; string s, x, y; set<string> v; cin >> x >> y; x[0] = x[0] - a + 1 + 0 ; a = x[0] - a + 1; b = x[1] - 0 + 1; e = x[0]; f = x[1]; y[0] = y[0] - a + 1 + 0 ; v.insert(x); ...
// (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 ...
#include <bits/stdc++.h> using namespace std; const int N = 100005; struct Query { int idx, k; }; int n, m; int c[N], ans[N], cnt[N], pref[N]; vector<Query> qs[N]; vector<int> adj[N]; void read() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> c[i]; for (int i = 1; i <= n - 1; i++...
#include <bits/stdc++.h> using namespace std; int a[100005]; int main() { int n, m, c; cin >> n >> m >> c; for (int i = 1; i <= m; i++) { int x, ans; cin >> x; if (x <= c / 2) { for (int j = 1; j <= n; j++) { if (x < a[j] || a[j] == 0) { a[j] = x; ...
module test_bench(clk, rst); input clk; input rst; wire [63:0] wire_39069600; wire wire_39069600_stb; wire wire_39069600_ack; wire [63:0] wire_39795024; wire wire_39795024_stb; wire wire_39795024_ack; wire [63:0] wire_39795168; wire wire_39795168_stb; wire wire_39795168_ack; ...
module digital_sound_output ( input clk, input rst, input enabled, input[15:0] left, input[15:0] right, output bck, output sd, output lrck, output consume ); parameter CLK_FREQUENCY = 33868800; localparam BCK_HALF_PERIOD = (CLK_FRE...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<pair<int, string> > > rg(m, vector<pair<int, string> >(1)); for (int i = 0; i < n; i++) { string sn; int r, s; cin >> sn; scanf( %d %d , &r, &s); rg[r - 1].push_back(make_p...
#include <bits/stdc++.h> using namespace std; int x[3010], y[3010]; vector<int> py[3010]; int L[3010], R[3010], q, k; void nxt(int &u, int k = 1) { while (k-- > 0) u = R[u]; } void pre(int &u, int k = 1) { while (k-- > 0) u = L[u]; } long long res = 0; struct node { int x, y; bool op...
#include <bits/stdc++.h> using namespace std; char c; int mo = 1000003; int main() { int pre = 0; while (scanf( %c , &c) != EOF) { if (c < 32 || c > 126) break; int w = c; int tmp = 0; for (int j = 0; j < 8; j++) { tmp = tmp * 2 + w % 2; w /= 2; } w = ...
#include <bits/stdc++.h> using namespace std; const long long inf = 1 << 30; const long long Inf = 1ll << 60ll; namespace io { char buf[(1 << 23)], *p1 = buf, *p2 = buf, c; long long f; template <typename T> T read() { T x = 0; f = 0; c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, (1 << 2...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: cpx_buf_io.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...
//------------------------------------------------------------------- // // 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> #pragma comment(linker, /STACK:256000000 ) using namespace std; int main() { int n; scanf( %d , &n); printf( %d , n); for (int i = 1; i < n; i++) printf( %d , i); return 0; }
//----------------------------------------------------------------------------- // Copyright 2017 Damien Pretet ThotIP // Copyright 2018 Julius Baxter // // 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...
#include <bits/stdc++.h> namespace XX { template <template <typename> class Compare, typename T> inline T& UP(T& x, const T& y) { if (Compare<T>()(y, x)) x = y; return x; } template <typename Compare, typename T> inline T& UP(T& x, const T& y, Compare comp) { if (comp(y, x)) x = y; return x;...
`timescale 1ns/10ps module vga_pll_0002( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'locked' output wire locked ); altera_pll #( .fractional_vco_multiplier("false...
#include <bits/stdc++.h> using namespace std; int r, c; string str_col[1000006]; string str_dir[1000006]; vector<int> e[1000006], rev[1000006]; int col[1000006], vis[1000006], vis2[1000006]; int cyc_len, black_cnt; inline int id(int x, int y) { return c * x + y; } vector<int> st; int got[1000006]; ...
/* * 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...
// file: mmcm_mkid_tb.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not...
#include <bits/stdc++.h> using namespace std; int n, x, i, w[100005], sum; int main() { cin >> n >> x; for (i = 1; i <= n; i++) { cin >> w[i]; sum = sum + w[i]; } if (sum + n - 1 == x) cout << YES ; else cout << NO ; }
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, i; while (scanf( %lld %lld , &n, &k) != EOF) { vector<long long int> v; for (i = 1; i * i <= n; i++) { if (n % i == 0) { v.push_back(i); if ((n / i) != i) v.push_back(n / i); } ...
#include <bits/stdc++.h> int main() { int t, j; scanf( %d , &t); for (j = 1; j <= t; j++) { int n, d = 0, i; char a[100000], b[100000], c[100000]; scanf( %s %s %s , a, b, c); n = strlen(a); for (i = 0; i < n; i++) { if (a[i] == c[i] || b[i] == c[i]) d++; if (a...
#include <bits/stdc++.h> using namespace std; int n, k, p; int dp[111][555555], cur[111], a[555555], ld[111], sum[555555], dpp[555555], bit[1111], sz; void update(int x, int p) { while (x <= sz) { bit[x] = max(bit[x], p); x += x & (-x); } } int query(int x) { int res = 0; w...
#include <bits/stdc++.h> using namespace std; const int N = 100 + 5; int n, m, ord[N << 1], nord = 0; vector<int> adj[N << 1], radj[N << 1]; bool vis[N << 1]; int ncmp = 0, cmp[N << 1]; vector<int> ans; inline void addedge(int u, int v) { adj[u].push_back((v > n ? v - n : v + n)); ; radj[(v ...
/* * 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-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:37:54 2016 // Host : jalapeno running 64-bit unknown // Command ...
// MBT 4/1/2014 // DWP 11/27/2019 // // 3 read-port, 1 write-port ram // // reads are asynchronous // // this file should not be directly instantiated by end programmers // use bsg_mem_3r1w instead // `include "bsg_defines.v" module bsg_mem_3r1w_synth #(parameter `BSG_INV_PARAM(width_p) , parameter `BSG_INV_PA...
#include <bits/stdc++.h> int s, k; long long f[1000], res[1000]; int main() { scanf( %d %d , &s, &k); f[0] = 0; f[1] = 1; int i; for (i = 2; f[i - 1] <= s; i++) for (int j = 1; i - j > 0 && j <= k; j++) f[i] += f[i - j]; int cnt = 0; for (i = i - 1; i >= 0; i--) if (f[i] <=...
#include <bits/stdc++.h> using namespace std; int n, m, q, a[200010], b[200010], pos[200010], lst[200010]; int f[200010][30], G[200010][30], L[200010]; int amax(int a, int b) { return a > b ? a : b; } int main() { int i, j, cnt, poss, t, l, r; scanf( %d%d%d , &n, &m, &q); for (i = 1; i <= n; i++) ...
`timescale 1ns / 1ps module controler_tb(); reg power, start_pause, weight_ch, mode_ch, clk_src; wire power_light; wire start_pause_light, water_in_light, washing_light, rinsing_light, dewatering_light, water_out_light; wire [7:0]anodes, cnodes; wire [2:0]weight_ch_light; wire [2:0]state; ...
/** * 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...
Require Import StructTact.StructTactics. Require Import InfSeqExt.infseq. (** Given a hypothesis H of the form H: forall ex, P ex -> Q ex -> rest, replace H with H: forall ex, (Q /\_ P) ex -> rest. *) Ltac accum_and_tl H P Q rest ex := let H' := fresh in ...