text stringlengths 59 71.4k |
|---|
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE revB.2 compliant I2C Master controller Top-level ////
//// ////
//// ... |
// (c) Copyright 1995-2017 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 ... |
//-------------------------------------------------------------------
//-- genromleds_tb.v
//-- Banco de pruebas para el secuenciador de luces, implementado con
//-- una memoria rom generica
//-------------------------------------------------------------------
//-- BQ August 2015. Written by Juan Gonzalez (Obijuan)
//-... |
#include <bits/stdc++.h> using namespace std; int n, m, c0, d0, hsl; int a[15], b[15], c[15], d[15]; int dp[1005][15]; bool dpf[1005][15]; int proc(int x, int num) { if (num == 0) { return 0; } else if (dpf[x][num]) { return dp[x][num]; } else { int &ret = dp[x][num]; ret... |
#include <bits/stdc++.h> using namespace std; int e[1010][1010]; int main(void) { int n, a, b; scanf( %d%d%d , &n, &a, &b); if (a > 1 && b > 1) { printf( NO n ); return 0; } int x = n - max(a, b) + 1; if (x <= 0 || ((n == 2 || n == 3) && x == n)) { printf( NO n ); r... |
#include <bits/stdc++.h> int main() { char c, str[100]; int i; scanf( %c , &c); getchar(); gets(str); if (c == L ) { for (i = 0; i < strlen(str); i++) { if (str[i] == q ) { str[i] = w ; } else if (str[i] == w ) { str[i] = e ; } else if (st... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; long long n; cin >> n; long long d = 0; vector<long long> v; vector<long long> a; long long val = 0; map<long long, long long> m; long long start = 0, end = -1, c... |
module FSM (
input Reset_n_i,
input Clk_i,
input In0_i,
input In1_i,
input In2_i,
input In3_i,
input In4_i,
input In5_i,
input In6_i,
input In7_i,
output Out0_o,
output Out1_o,
output Out2_o,
output Out3_o,
output Out4_o,
output Out5_o,
output Out6_o,
output Out7_o,
output Out8_o,
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5005; const int maxm = maxn * 2; const int maxe = 200005; const int mod = 1e9 + 7; int n, a, b; string str; int cc[26][maxn][26]; int exist[26]; int main() { cin >> str; n = str.length(); for (int i = 0; i < n; i++) { i... |
//Instruction decoder
`include "verilog/mips_instr_defines.v"
module decode
(
input wire[31:0] instr_dec_i,
input wire sign_ext_i,
output wire[4:0] rt_dec_o,
output wire[4:0] rs_dec_o,
output wire[4:0] rd_dec_o,
output wire[5:0] op_dec_o,
... |
#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; int main() { long long a, b, w, x, c; cin >> a >> b >> w >> x >> c; long long delta = c - a; if (delta <= 0) { cout << 0 << endl; } else { double k = (1.0 * delta * x - b) / (w - x); long long t = ceil(delta + k); cout << t <<... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; cin >> n >> m; int A[n][m], row[n], col[m]; char c; memset(row, 0, sizeof(row)); memset(col, 0, sizeof(col)); for (int i = 0; i < n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, otv = 0, otv1 = 0; cin >> n; vector<long long> v(n); for (long long j = 0; j < n; j++) { cin >> v[j]; } for (long long j = 1... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module seq_gen
#(
parameter BASEADDR = 16'h0000,... |
#include <bits/stdc++.h> using namespace std; inline void pisz(int n) { printf( %d n , n); } const int MAX_N = 200010; int n; char a[MAX_N]; char b[MAX_N]; double s1[26][MAX_N]; double s2[26][MAX_N]; void precompute() { s1[b[1] - A ][1] = 1UL; for (int(i) = (2); (i) <= (n); ++i) { for (... |
//==================================================================================================
// Filename : RKOA_OPCHANGE.v
// Created On : 2016-10-26 23:25:59
// Last Modified : 2016-10-27 08:51:06
// Revision :
// Author : Jorge Esteban Sequeira Rojas
// Company : Instituto Tec... |
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef long double ld; #define F first #define S second const int MOD = 998244353;// XXX const int C = 26;// XXX void add(int &x, int y){ x += y; while (x >= MOD) x -= MOD; whil... |
/**
* 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> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int MAXN = 3005; int r, c, n, k; pair<int, int> v[MAXN]; int prv[MAXN], nxt[MAXN]; vector<int> y[MAXN], x[MAXN]; int pos[MAXN]; int num[MAXN]; int cnt; long long ans; int res; bool cmp_x(int num1, i... |
#include <bits/stdc++.h> using namespace std; const int mx = 4e5 + 10; int sum[mx]; int x[mx]; int n, m; void add(int x) { while (x <= 2 * n + 1) { sum[x]++; x += x & (-x); } } int query(int x) { int ans = 0; while (x) { ans += sum[x]; x -= x & (-x); } ret... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const long long INFL = 1e18 + 123; const double PI = atan2(0, -1); mt19937 tw(960172); long long rnd(long long x, long long y) { static uniform_int_distribution<long long> d; return d(tw) % (y - x + 1) + x; } int cross(int x1... |
#include <bits/stdc++.h> using namespace std; template <class T> bool setmax(T &_a, T _b) { if (_a < _b) { _a = _b; return true; } return false; } inline void Boost() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main() { int n, k; cin >> n... |
/*
* 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() { long long int t, n, i, s, a1, b1, m; cin >> t; while (t--) { cin >> n >> m; if (n < m) { cout << 0 n ; continue; } if (n == m) cout << n % 10 << n ; else { long long int a[10] = {}... |
module main;
// Declare word1 as a VARIABLE
struct packed {
logic [7:0] high;
logic [7:0] low;
} word1;
// Declare word2, word3 as a NET
wire struct packed {
logic [7:0] high;
logic [7:0] low;
} word2, word3;
assign word2.high = word1.high;
assign word2.low = word1.lo... |
#include <bits/stdc++.h> using namespace std; struct station { int pos, price; } a[200003]; int T[800008], d, n, m; long long cnt; bool comp(station A, station B) { return (A.pos < B.pos); } void Build_MinIT(int, int, int); int Find_Min(int, int, int, int, int); int main() { scanf( %d %d %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... |
//-----------------------------------------------------------------------------
// Copyright 2017 Damien Pretet ThotIP
//
// 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... |
#include <bits/stdc++.h> using namespace std; const int N = 100100; int n, a[N], b[N], p[N]; int main() { if (fopen( 180F.in , r )) freopen( 180F.in , r , stdin); scanf( %d n , &n); for (int i = 1; i <= n; i++) { scanf( %d , a + i); } for (int i = 1; i <= n; i++) { scanf( %d , ... |
/*
* Synchronous read 1r1w content addressable memory module.
* Each entry has a tag and a data associated with it, and can be
* independently cleared and set
*
* This module is similar to bsg_cam_1r1w_sync, except it allows for an
* external replacement scheme
*/
`include "bsg_defines.v"
module bsg_cam_1r... |
//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 associated do... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; vector<string> nap(n); for (int i = 0; i < n; ++i) cin >> nap[i]; vector<vector<int> > dp(26); for (int i = 0; i < 26; ++i) for (int j = 0; j < 26; ++j) dp[i].push_back(0); ... |
// nios_tester_mm_interconnect_0_avalon_st_adapter_008.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module nios_tester_mm_interconnect_0_avalon_st_adapter_008 #(
para... |
//---------------------------------------------------------------------
//
// Company: UNSW
// Original Author: Lingkan Gong
// Project Name: XDRS Demo
//
// Create Date: 12/06/2010
// Design Name: xbuscore
//
//---------------------------------------------------------------------
`timescale 1ns/1ns
module xbu... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:65777216 ) using namespace std; char s[1111][1111]; int n, m; int best; int now; int v[1111][1111]; vector<pair<int, int> > c; bool u[1111][1111]; void dfs(int x, int y) { if (u[x][y]) return; u[x][y] = true; for (int dx(-1); dx < ... |
// file: SysMon_exdes.v
// (c) Copyright 2009 - 2010 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 l... |
`timescale 1ns/1ns
// CRC16
// Copyright 2010 University of Washington
// License: http://creativecommons.org/licenses/by/3.0/
// 2008 Dan Yeager
// 2 direction module.
// inclk, inbit generate crc
// outclk, outbit read out crc.
module crc16(reset, crcinclk, crcbitin, crcoutclk, crcbitout, crcdone);
input reset, cr... |
#include <bits/stdc++.h> using namespace std; int n, m, nex[2000000], hea[2000000], wen[2000000], val[2000000], aid[2000000], root2, root1, len, maxx; struct segment_tree { int a[2000000][2], lazy[2000000], fa[1000000], dep[1000000], in[1000000], out[1000000], m; void pushdown(int k) { ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 51; struct BIT { int x[MAXN]; inline void add(int pos, int val); inline int query(int pos); }; BIT bit; int n, tp, res, totd, r; int x[MAXN], d[MAXN], st[MAXN], f[MAXN], g[MAXN]; long long int dsc[MAXN]; inline int read()... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 100 + 10; int a[MAXN], b[MAXN]; int dp[MAXN][310]; vector<int> vec1[MAXN], vec[MAXN]; long long n, m, second, E; bool ok(int k) { long long need = second; for (int i = k - 1; i < n; i++) if (dp[i][k] < m) need = min(need, ... |
#include <bits/stdc++.h> using namespace std; int n; long long arr[200011]; long long sum[200011]; bool check(int k) { int i; for (i = 1; i <= n; i++) sum[i] = 0; for (i = n; i >= 3; i--) { if (sum[i] + arr[i] < k) return 0; long long d = (sum[i] + arr[i] - k) / 3; long long d3 =... |
module system ( input CLK,
//DE0 ADC
output ADC_CS,
output ADC_SCLK,
output ADC_SDO,
input ADC_SDI,
//DE0 USER IO
input [1:0] BTNS,
... |
#include <bits/stdc++.h> long long m; long long from, to; long long x, y; int visit[2][1000010]; int main() { std::cin >> m; int i, time; int cs[2], ci[2], targ[2]; for (i = 0; i < 2; ++i) { std::cin >> from >> to >> x >> y; time = 1; int cur = from; while (true) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 101000; const double eps = 1e-9, g = 9.8; double V, angle, ca, sa, Y, K, x, y; int i, j, k, l, m, n, o, p; inline int sn(double x) { return x < -eps ? -1 : x > eps ? 1 : 0; } inline double Sqr(double x) { return x * x; } struct Point { doub... |
#include <bits/stdc++.h> using namespace std; using SI = set<int>; using ULL = unsigned long long; using LL = long long; using VI = vector<int>; using LD = long double; using PULL = pair<ULL, ULL>; using UI = unsigned int; using PLL = pair<LL, LL>; using PDD = pair<LD, LD>; using MII = map<int, in... |
#include <bits/stdc++.h> using namespace std; const int P = 1000000007; const int N = 1010000; int fail[N]; int go[N][26], len[N], diff[N], anc[N], lst; int n; char str[N]; int p; int s[N]; int f[N], g[N]; void addChar(int c, int ww) { int x = lst; while (s[ww] != s[ww - len[x] - 1]) { ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 9; const long long mod1 = 1000000; ostringstream convert; long long n, m, cur, dp[100][300]; long long res; long long nbb = 0, nss = 0, ncc = 0, wmin, wmax; long long nb, ns, nc, pb, ps, pc, mx = 0; string s, s2; string a[1000... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
* for EE577b Troy WideWord Processor Project
*/
// IMPORTANT: This requires an input text file named "rf1.fill"
// Include definition of the control signals
`include "control.h"
// Non-synthesizable behavioral RTL model for the instruction memory
mo... |
#include <bits/stdc++.h> using namespace std; int main() { int l, r, x, y, k; scanf( %d%d%d%d%d , &x, &y, &l, &r, &k); int L = (int)ceil(1.0 * x / k), R = (int)floor(1.0 * y / k); if (R < L || R < l || r < L) puts( NO ); else puts( YES ); return 0; } |
/*
* Instruction decoder for Zet
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; 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 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; char a[53][53] = {5}; int ans = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { char x; cin >> x; if (x == a || x == f || x == c || x == e ) a[i][j] = 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... |
/**
* 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) 2000-2012 Bluespec, Inc.
// 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, pub... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Rose-Hulman Institute of Technology
// Engineer: Adam and Mohammad
// Create Date: 20:16:03 10/24/2015
// Design Name: The top-level data unit of the design
// Module Name: MasterDataUnitI2C
/... |
/**
* 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_exu_ecc_dec.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... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; reverse(t.begin(), t.end()); if (s == t) cout << YES ; else cout << NO ; } |
// 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 : Thu Feb 09 23:36:35 2017
// Host : TheMosass-PC running 64-bit major release ... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora 64B/66B
// Company: Xilinx
//
//
//
// (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected unde... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e6; const long long MOD = 1e9 + 7; const long long N = 1e6 + 7; const long long N_N = 1e3; const int INF = 1e9 + 228; const long double eps = 1e-12; long long n, a[N], ans, l, ans1; int main() { cin >> n; for (int i = 1; i <=... |
#include <bits/stdc++.h> using namespace std; int dist(int x, int y) { if (y > x) return (y - x); else return (12 - x + y); } int main() { int i, j, q, r, t; string a, b, c; cin >> a >> b >> c; map<string, int> m; m[ C ] = 1; m[ C# ] = 2; m[ D ] = 3; m[ D# ] =... |
#include <bits/stdc++.h> using namespace std; std::vector<long long> digit(long long num) { string str, s; std::vector<long long> v; str = to_string(num); for (int i = 0; i < str.size(); ++i) { s = str[i]; v.push_back(stoi(s)); } return v; } void solve() { long long num, ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, a, b, c = 0; cin >> n >> x; while (n--) { cin >> a >> b; if (x == a || x == b || x == 7 - a || x == 7 - b) c++; x = 7 - x; } if (c > 0) cout << NO << endl; else cout << YES << endl; ret... |
/*
Microcode Execute
Microcode Op
31:24, Opcode
23, Last Uop (Reset to Start)
*/
`include "ArithAlu.v"
`include "MemAlu.v"
`include "GpReg.v"
`include "MemTile.v"
`include "DecOp.v"
/*
module ExUop(
clk,
istrWord,
uopWord,
uopCmd,
idRegD,
idRegS,
idRegT,
idImm
);
*/
module ExUop(clk);
input clk; ... |
//-----------------------------------------------------------------------------
// Title : GT Common wrapper
// Project : 10GBASE-R
//-----------------------------------------------------------------------------
/... |
#include <bits/stdc++.h> using namespace std; const int N = 1002, M = 10002; pair<int, long long> dp[N][M]; map<long long, int> di; bool vis[N][M]; int nxt[N][M]; long long a[N], b[N], k; int T[M][N]; int n; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b)... |
#include <bits/stdc++.h> using namespace std; const int N = 55; int n, k, dp[N][N]; long long a[N], sum[N], dq; int main() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %lld , &a[i]); for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i]; for (int i = 60; i >= 0; i--) { ... |
#include <bits/stdc++.h> const int MAXINT = 2147483640; const long long MAXLL = 9223372036854775800LL; const long long MAXN = 1123456; const long long MOD = 1123456769; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); srand(time(0)); vector<int> v; int n, m... |
#include <bits/stdc++.h> int main() { int n, k, i, j; int hols, arr[1000]; int temp, loop, flag = 0; scanf( %d%d , &n, &k); scanf( %d , &hols); for (i = 0; i <= n; i++) { arr[i] = 0; } for (i = 0; i < hols; i++) { scanf( %d , &temp); arr[temp] = 2; } for (i = ... |
`timescale 1ns / 1ps
// synopsys template
module MUX
(
IN0,
IN1,
SEL,
F
);
input IN0, IN1, SEL;
output F;
assign F = (~SEL&IN0)|(SEL&IN1);
endmodule
module HADDER
(
IN0,
IN1,
SUM,
COUT
);
input IN0, IN1;
output SUM, COUT;
assign SUM = IN0^IN1;
assign COUT = IN0&IN1;
endmo... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; constexpr int MAXN = 1003; constexpr int MAXC = 10004; int n; ll w, b, x; int c[MAXN]; ll cost[MAXN]; ll dp[MAXN][MAXC]; int main() { ios_base::sync_with_stdio(false); ... |
// 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 13:53:00 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; long long int powmod(long long int a, int b, int n) { long long int rm = 1; while (b) { if (b % 2) { rm = (rm * a) % n; } a = (a * a) % n; b /= 2; } return rm; } int main() { int n; long long int a[110]; 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 la... |
#include <bits/stdc++.h> using namespace std; int n, t; string s; int puc(int k, int t) { vector<int> v(n + 1, 0); v[n - 1] = (s[n - 1] == H ); for (int i = n - 2; i >= 0; --i) v[i] = v[i + 1] + (s[i] == H ); int nh = 0, ns = 0; for (int i = 0; i < int(n); ++i) { if (s[i] == H ) ... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const double PI = 3.141592653589793; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } struct Pt { double x, y; Pt(double a = 0, double b = 0) : x(a), y(b) {} bool operator==(const Pt& p) const { re... |
// (C) 2001-2016 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... |
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
// Date : Sun Sep 22 02:34:38 2019
// Host : varun-laptop running 64-bit Service Pac... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int a, long long int b) { if (b == 0) return 1; if (b == 1) return a; long long int r = power(a, b / 2) % 1000000007; if (b % 2 == 0) return (r * r) % 1000000007; else return (((r * r) % 1000000007) * a) % 10... |
#include <bits/stdc++.h> using namespace std; long long hit(long long n) { return ((1 + n) * n) / 2; } int main() { long long m, n; scanf( %lld%lld , &n, &m); long long hasilmin, hasilmax; hasilmin = hit(n / m) * (n % m) + hit(n / m - 1) * (m - n % m); hasilmax = hit(n - m); printf( %lld %... |
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2015.2 (lin64) Build Fri Jun 26 16:35:25 MDT 2015
// Date : Sun Oct 4 22:06:59 2015
// Host : cascade.andrew.cmu.edu running 64-bit Red H... |
// -- (c) Copyright 2009 - 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 a... |
#include <bits/stdc++.h> using namespace std; const long double E = 1e-7; const int MOD = 1e9 + 7; const long long MAX = 1e6 + 1; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n, k; cin >> n >> k; int ar[n]; for (int i = 0; i < n; i++) cin >> ar[i]; ... |
#include <bits/stdc++.h> using namespace std; map<long long, long long> tedad; int main() { long long a; string s; cin >> a; cin >> s; long long ans = 0; for (int i = 0; i < s.size(); i++) { for (int j = i, sum = 0; j < s.size(); j++) { sum += s[j] - 48; tedad[sum]++;... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
/*
* Copyright (c) 2000 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 License, or (at your option)
* ... |
#include <bits/stdc++.h> int main() { int n; while (scanf( %d , &n) != EOF) { if (n % 2 == 1) { printf( -1 n ); continue; } printf( 2 1 ); for (int i = 3; i < n; i = i + 2) printf( %d %d , i + 1, i); printf( n ); } return 0; } |
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return + s + ; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? true : false ); } template <typename A, typename B> string to_string(pair<A, B> p) { return ( + ... |
#include <bits/stdc++.h> using namespace std; long long i, j, k, n, t, s, p[100009], d[100009], a[100009]; int main() { cin >> n; for (i = 1; i <= n; i++) cin >> p[i]; for (i = 1; i <= n; i++) if (!d[i]) { k = 0; j = i; while (d[j] == 0) { d[j] = 1; 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 la... |
`timescale 1ns/10ps
module hps_design_PLL(
// 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("fal... |
// ====================================================================
// Radio-86RK FPGA REPLICA
//
// Copyright (C) 2011 Dmitry Tselikov
//
// This core is distributed under modified BSD license.
// For complete licensing information see LICENSE.TXT.
// -----------------------------... |
// -- (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
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
//======================================================================
//
// blockmem_rw32_r128.v
// --------------------
// Test implementation of a block memory that has different data
// widths on external (api) and internal ports.
// Author: Joachim Strombergson, Peter Magnusson
// Copyright (c) 2015, Assured AB
... |
#include <bits/stdc++.h> using namespace std; int n, ans; bool pd(int n) { for (int i = 2; i <= sqrt(n); i++) if (n % i == 0) return false; return true; } int main() { scanf( %d , &n); if (pd(n)) puts( 1 ); else if (n % 2 == 0 || pd(n - 2)) puts( 2 ); else puts(... |
`include "FpuFp32_Add.v"
`include "FpuFp32_Mul.v"
`include "FpuFp32_Rcp.v"
module FpuFp32(
/* verilator lint_off UNUSED */
clk,
opMode,
srca,
srcb,
dst
);
input clk;
input[3:0] opMode;
input[31:0] srca;
input[31:0] srcb;
output[31:0] dst;
parameter[3:0] OP_NONE = 4'h00;
parameter[3:0] OP_ADD = 4'h01;
p... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimization( unroll-loops ) using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; int read_int() { bool minus = false; int result = 0; char ch; ch = getchar(); while (1) { if... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.