text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int a[300001]; long long an[300001], dp[300001]; struct data { int x, y, No; void scan() { scanf( %d%d , &x, &y); } bool operator<(data b) const { if (y < b.y) return 0; if (y > b.y) return 1; int r1 = x % y, r2 = b.x % y; if (r1 ... |
//-----------------------------------------------------------------------------
//
// (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 pro... |
#include <bits/stdc++.h> using namespace std; int main() { char c; char prev; vector<int> A; int i = 0, count = 1; scanf( %c , &prev); A.push_back(1); while (scanf( %c , &c) != EOF) { if (c != + && c != - ) continue; if (c == prev) { A[i]++; } else { ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<vector<int>> grid(n, vector<int>(m, 0)); vector<vector<int>> up(n, vector<int>(m, 0)); vector<vector<int>> down(n, vector<int>(m, 0));... |
#include <bits/stdc++.h> using namespace std; string vow = aeiou ; const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2}; const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1}; const int dx[] = {-1, 0, 0, 1}; const int dy[] = {0, -1, 1, 0}; const long double pie = 3.14159265358979; const long long mod = 1e9 ... |
#include <bits/stdc++.h> using namespace std; inline long long max(long long a, long long b) { return a > b ? a : b; } inline long long min(long long a, long long b) { return a > b ? b : a; } template <typename T> inline int read(T& res) { long long x = 0, f = 1, flag = 0; char ch; flag = ch = get... |
#include <bits/stdc++.h> using namespace std; struct st { int x, y; bool operator<(const st o) const { return y < o.y || (y == o.y && x < o.x); } }; long long a[1000000][2]; long long n, m, x, y; long long M[1000000][2]; int main() { cin >> n >> m; cin >> M[0][0] >> M[0][1]; for (int i... |
#include <bits/stdc++.h> using namespace std; signed main() { long long int t; cin >> t; while (t--) { long long int n, x, i; cin >> n >> x; long long int second = 0; long long int a[n]; for (long long int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:48:40 05/03/2015
// Design Name: control_unit
// Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_control_with_fetch.v
// Project Name: processor
// ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 550; struct DDF { int n; int v[maxn]; int dp[maxn][maxn]; int dfs(int l, int r) { if (l >= r) return dp[l][r] = 1; if (~dp[l][r]) return dp[l][r]; long long ans = dfs(l + 1, r); for (i... |
#include <bits/stdc++.h> using namespace std; int main() { int h, n; cin >> n >> h; for (int i = 1; i <= n; i++) { if (i % 2 == 1) { for (int j = 1; j <= h; j++) { cout << # ; } } else { if ((i / 2) % 2 == 1) { for (int j = 1; j <= h - 1; j++) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long int; ll hell = 998244353; int main() { ll n; cin >> n; vector<ll> v[n]; for (ll i = 0; i < n; ++i) { ll x; cin >> x; for (ll j = 0; j < x; ++j) { ll y; cin >> y; v[i].push_back(y); ... |
// megafunction wizard: %LPM_COUNTER%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_COUNTER
// ============================================================
// File Name: COUNTER.v
// Megafunction Name(s):
// LPM_COUNTER
//
// Simulation Library Files(s):
// lpm
// ====================================... |
#include <bits/stdc++.h> using namespace std; const int maxn = 400050; int n, x; long long w; vector<long long> val[4]; int Abs(int a) { return a < 0 ? -a : a; } int main() { scanf( %d , &n); long long sum = 0; for (int i = 0; i < n; i++) { scanf( %d%I64d , &x, &w); if (x == 11) ... |
/* Basic Gates */
module or2(output Z, input A, B);
wire i;
not(Z, i);
nor(i, A, B);
endmodule
module or4(output Z, input A, B, C, D);
wire [1:0]i;
or2 o0(i[0], A, B),
o1(i[1], C, D),
o2(Z, i[0], i[1]);
endmodule
module and2(output Z, input A, B);
nand(nz, A, B);
not(Z, nz);
endmodule
module and3(ou... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, k; cin >> n >> m >> k; int a[m + 1]; for (int i = 0; i < m + 1; i++) { cin >> a[i]; } int ans = 0; for (int i = 0; i < m; i++) { i... |
#include <bits/stdc++.h> using namespace std; int n, v; int main() { cin >> n >> v; int ans = 0; int p = 1; int cur = 0; for (int i = n - 1; i >= 0; i--, p++) { if (cur >= i) continue; ans += p * (min(i, v - cur)); cur = cur + min(i, v - cur) - 1; } cout << ans << end... |
#include <bits/stdc++.h> using namespace std; int k[3], n, pos[200005]; int dp[200005][3]; int main() { ios::sync_with_stdio(0); for (int i = 0; i < 3; i++) cin >> k[i], n += k[i]; for (int t, p = 0; p < 3; p++) for (int i = 1; i <= k[p]; i++) { cin >> t, pos[t] = p; } for (i... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_zckgatedcap_h.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 ... |
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=1 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" clk2_divide_by=25000 clk2_duty_cycle=50 clk2_multiply_by=1 clk2_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_devi... |
#include <bits/stdc++.h> using namespace std; long long i, j, m, n, p, q, r, ans, l, ch = 1; string s; int f; vector<long long> v; int main() { cin >> s; l = s.size(); f = s.find( bear , 0); while (f >= 0) { p = f + 1; ch = abs(p - ch) + 1; q = p + 3; r = (l - q) + 1;... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2018 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of variou... |
#include <bits/stdc++.h> using namespace std; int n = 0, c = 0; float y = 0; int main() { if (!n) { scanf( %d , &n); main(); } else if (c == n) { printf( %.3f , 5 + y / n); return 0; } else { float x; scanf( %*f %f , &x); y += x; c++; main(); ... |
// file: dacclk_mmcm_exdes.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 i... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000; int fs[100], ft[100]; char c[1050], s[100], t[100]; int dp[1050][100][100]; void GetNextval(char* p, int next[]) { int pLen = strlen(p); next[0] = -1; int k = -1; int j = 0; while (j < pLen) { if (k == -1 || p[j] ... |
#include <bits/stdc++.h> using namespace std; long long n, len, lcm, g, mod; long long a[266666], b[266666], c[266666], d[266666], e[266666], f[266666]; long long pw[266666], tmp[266666], w[2][266666], rev[266666]; long long mul(long long a, long long b) { return (a * b - (long long)(((long double)a * b +... |
#include <bits/stdc++.h> using namespace std; const int maxn = 80005, maxe = 3000005, maxs = 80005, INF = 0x3f3f3f3f; int n, q, N, m, S, T, a[maxn]; struct event { int x, l, r, f; event(int _x = 0, int _l = 0, int _r = 0, int _f = 0) : x(_x), l(_l), r(_r), f(_f) {} bool operator<(const event... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: California State University San Bernardino
// Engineer: Bogdan Kravtsov
// Tyler Clayton
//
// Create Date: 11:10:00 10/17/2016
// Module Name: PIPELINE
// Project Name: MIPS ... |
/**
* 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 NN = 1010; const int MM = 101010; struct Node { int id; int x, y; } Q[MM]; int a[NN][NN]; vector<int> adj[MM]; int ans[MM], f[MM]; int n, m, k; void dfs(int u, int fa = 0, int crr = 0) { if (Q[u].id == 1) { int x = Q[u].x, y =... |
/**
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Mar 31 09:06:21 2017
// Host : Shaun running 64-bit major release (bu... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int dr8[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dc8[] = {1, -1, 0, 0, -1, 1, -1, 1}; int dr4[] = {0, 1, -1, 0}; int dc4[] = {1, 0, 0, -1}; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; int on = 1023; ... |
#include <bits/stdc++.h> using namespace std; int const MAX = 200 * 1000 + 41; long double const EPS = 1e-12; bool eq(long double a, long double b) { return abs(a - b) < EPS; } bool leq(long double a, long double b) { return (a < b || eq(a, b)); } int n, w; int x[MAX]; int v[MAX]; pair<long double, lo... |
module EX_MEM_Seg(
input Clk,
input stall,
input flush,
input [31:0] Branch_addr,PC_add,
input [2:0] Condition,
input Branch,
input [2:0]PC_write,
input [3:0]Mem_Byte_Write,Rd_Write_Byte_en,
input MemWBSrc,OverflowEn,
input [31:0] MemData,WBData,
input Less,Zero,Overflow,
input [4:0]Rd,
output reg [31:0] Branch_addr... |
/**
* 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 rfid_reader_rx (
// basic connections
reset, clk, tag_backscatter,
// logistics
rx_done, rx_timeout,
// modulation infomation
miller, trext, divide_ratio,
// timing... |
/*
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Module | Partition | Slices* | Slice Reg | LUTs | LUTRAM | BRAM/FIFO | DSP48A1 | BUFG | BU... |
module test_lut_n();
//This is a test-bench for the look-up table. The point is to make sure that different instances of lut_n can
//reference different lookup tables stored in the (`include-d) file, cornerNclk.v.
//
//Ted Golfinopoulos, 13 Mar 2012
reg clk;
reg [13:0] n_clk_cnts; //Holds (imagined) clock counter - n... |
module I2C_AV_Config ( // Host Side
iCLK,
iRST_N,
o_I2C_END,
// I2C Side
I2C_SCLK,
I2C_SDAT );
// Host Side
input iCLK;
input iRST_N;
output o_I2C_END;
// I2C Side
output I2C_SCLK;
inout I2C_SDAT;
// Internal Registers/Wires
reg [15:0] mI2C_CLK_DIV;
reg [23:0] mI2C_DA... |
/**
* 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 = 200005; long long mod = (1e9 + 7); int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } bool is_vowel(char c) { if (c == a || c == e || c == i || c == o || ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; cout << 1 + 6 * (n) * (n + 1) / 2 << endl; } |
#include <bits/stdc++.h> using namespace std; const long long int inf = 1e9 + 7; const long long int mod = 998244353; long long int mini(long long int a, long long int b) { if (a >= b) return b; return a; } long long int maxi(long long int a, long long int b) { if (a >= b) return a; return b... |
// 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 : Sun Jun 04 14:48:58 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; string name[7]; int a, b, c, n, max_p, dexp, was[7]; bool p[7][7]; void perebor(int point, int num); int main() { name[0] = Anka ; name[1] = Chapay ; name[2] = Cleo ; name[3] = Troll ; name[4] = Dracul ; name[5] = Snowy ; name[6... |
#include <bits/stdc++.h> using namespace std; int c[3]; void solve() { int m, n; cin >> m >> n; vector<vector<int>> matrix(m, vector<int>(n)); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cin >> matrix[i][j]; } } for (int i = m - 1; i >= 0; --i) { f... |
/**
* 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... |
/**
* 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
module Approx_adder
#(parameter W=26, parameter LowL=16) (
input wire add_sub,
input wire [W-1:0] in1,
input wire [W-1:0] in2,
output wire [W:0] res
);
wire [W-1:0] in2_signed;
wire [LowL-1:0] lower_res;
wire approx_cout;
`ifdef ACAIN16Q4
assign in... |
#include <bits/stdc++.h> using namespace std; const int INF = std::numeric_limits<int>::max() / 3; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } int dp[6000][6000]; long long sum[1000000]; long long mi... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 200015; const int nil = 100005; int n; set<pair<int, int> > S; set<pair<int, int> > T; int w[Maxn]; vector<pair<int, int> > cand[Maxn]; pair<int, int> res[Maxn]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { i... |
/*
* Milkymist 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 distribut... |
/* ltcminer.v
*
* Copyright (c) 2013 kramble
* Parts copyright (c) 2011
*
* 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... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 3; const long long linf = (long long)inf * inf + 2; int N, K; struct TrieNode { TrieNode *children[26]; bool canWin, canLose; TrieNode() { canWin = canLose = false; for (int i = 0; i < 26; ++i) children[i] = nullptr; ... |
/**
* 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... |
// Example module that doesn't instantiate
module appendix1 (/*AUTOARG*/
// Outputs
z,
// Inputs
i
);
input i;
output z;
/*AUTOREG*/
// Beginning of automatic regs (for this module's undeclared outputs)
reg ... |
// alu.v
//
// AVM alu in Verilog
//
// This is an implementation of AVM in C for experimenation purposes.
// It is both an AVM interpretr and an assembler for the instruction set.
//
// (C) 2016 David J. Goehrig
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modi... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:02:05 12/03/2016
// Design Name:
// Module Name: animation
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; int n, i, last[28], tmp[28]; long long ans[28]; char s[300005]; int main() { scanf( %s , s); for (i = 0; i <= 26; i++) last[i] = -1; int length = strlen(s); for (i = 0; i < length; i++) { last[s[i] - a ] = i; for (int j = 0; j <= 26; 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... |
// (C) 2001-2011 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 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 dist(int a, int b) { return min(abs(a - b), 360 - abs(a - b)); } long long d; int main() { scanf( %I64d , &d); d = (d % 360 + 360) % 360; int ans = 1000; for (int i = 0; i < 4; i++) ans = min(ans, dist(d, 90 * i)); for (int i = 0; i < 4; i++)... |
#include <bits/stdc++.h> using namespace std; int A[2][2]; int main() { int d, i, n; cin >> n; int k = n; int cd = 0, ud = 0, c_i = 0, u_i = 0; while (k--) { cin >> i >> d; if (i == 0) c_i++; else u_i++; if (d == 0) cd++; else ud++;... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
/*
* Copyright (c) 2014 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> using namespace std; using namespace std; int M1(int x) { return x >= 1000000007 ? x - 1000000007 : x; } int M2(int x) { return x >= 1000000009 ? x - 1000000009 : x; } struct Hash { int a, b; Hash() { a = b = 0; } Hash(int a, int b) : a(a), b(b) {} Hash(int a) : a(a), ... |
`timescale 1ns / 1ps
// nexys3MIPSSoC is a MIPS implementation originated from COAD projects
// Copyright (C) 2014 @Wenri, @dtopn, @Speed
//
// 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,... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long inf = 1e9; const long long N = 1000 + 5; long long ar[N], done[N], cnt[N]; long long n; long long mex() { for (long long i = 0; i < n; i++) cnt[i] = 0; for (long long i = 0; i < n; i++) cnt[ar[i]] = 1; ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.1
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
#include <bits/stdc++.h> using namespace std; bool isPrime(int n) { for (int i = 2; (i * i) <= n; i++) { if (n % i == 0) return 0; } return 1; } int nerPr(int n) { for (int i = n;; i++) { if (isPrime(i)) return i; } } int main() { ios_base::sync_with_stdio(false); cin... |
#include <bits/stdc++.h> using namespace std; map<int, int> moebius(int n) { map<int, int> res; vector<int> primes; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { primes.push_back(i); while (n % i == 0) n /= i; } } if (n != 1) primes.push_back(n); int m = pr... |
#include <bits/stdc++.h> using namespace std; void p(double t) { cout << fixed << setprecision(13) << t << endl; exit(0); } struct tank { int hp, time, lo, hi, prob; void scan() { cin >> hp >> time >> lo >> hi >> prob; prob = 100 - prob; } }; int moven; vector<int> moves; ... |
//
// Generated by Bluespec Compiler, version 2013.01.beta5 (build 30325, 2013-01-23)
//
// On Mon Feb 3 15:05:32 EST 2014
//
//
// Ports:
// Name I/O size props
// c_request_get O 153
// RDY_c_request_get O 1
// RDY_c_response_put O 1
// RDY... |
/*
* 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() { double net, res; int d, h, vel, e; cin >> d >> h >> vel >> e; net = e - (vel / (3.14159265358979323846 * d * d / 4.0)); res = -h / net; if (res <= 0 || res > 10000) cout << NO n ; else cout << YES n << fixed << set... |
// ==============================================================
// 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 1 ns / 1 ps
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... |
//
// Copyright 2011 Ettus Research LLC
//
// 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 version.
//
// This program is dis... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04:35:15 04/02/2016
// Design Name:
// Module Name: ALU_32bit
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class t> using V = vector<t>; constexpr ll INF = 1e16; int n, m; ll dp[1502][1502]; int tab[1502][1502]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) for (int k = 1; k <= m; ++k) scanf( %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 law... |
// Copyright (c) 2014 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
(** Extraction : tests of optimizations of pattern matching *)
Require Coq.extraction.Extraction.
(** First, a few basic tests *)
Definition test1 b :=
match b with
| true => true
| false => false
end.
Extraction test1. (** should be seen as the identity *)
Definition test2 b :=
match b with
| true => ... |
#include <bits/stdc++.h> using namespace std; int gcf(int A, int B) { if (A < B) return gcf(B, A); else if (B == 0) return A; else return gcf(B, A % B); } int main() { int n, m; cin >> m >> n; bool A[m], B[n]; memset(A, 0, sizeof(A)); memset(B, 0, sizeof(B)); ... |
#include<bits/stdc++.h> using namespace std; #define pf printf #define PF(a) printf( %d n ,(a)) #define PF2(a,b) printf( %d %d n ,(a), (b)) #define PF3(a,b,c) printf( %d %d %d n ,(a), (b), (c)) #define PFL(a) printf( %lld n ,(a)) #defin... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int kolvo = 0; int kolvo1 = 0; for (int i = 0; i < n; i++) { if (a[i] == 5) { kolvo++; } if (a[i] == 0) { ... |
module instr_mem ( input [31:0] address,
output [31:0] instruction );
reg [31:0] memory [249:0];
integer i;
initial
begin
for (i=0; i<250; i=i+1) memory[i] = 32'b0;
// Insert MIPS's assembly here start at memory[10] = ...
//memory[10] = 32'b001000_00000_01000_0000000000000010; //addi $t0, $0, 2
... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005, MAXT = 500, INF = 0x3f3f3f3f; int mx[MAXT], add[MAXT], sz[MAXT], num[MAXT][MAXT], A[MAXN]; int N, T = 314; void upd(int p) { if (add[p]) { for (int i = 0; i < sz[p]; ++i) num[p][i] += add[p]; add[p] = 0; } } void in... |
/**
* 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; template <class t> inline t read(t &x) { x = 0; char c = getchar(); bool f = 0; while (!isdigit(c)) f |= c == - , c = getchar(); while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); if (f) x = -x; return x; } template ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, m; int volume[N]; int amount[N]; int parent[N]; int tofill[N]; int weight[N]; std::set<int> notFull; void reducePath(int index, int lead) { while (parent[index] != index) { int oldParent = parent[index]; par... |
`timescale 1ns/1ps
// This module is applicable to a X1 or X4 PCIe design.
// For independent channel design ( 2 X1 or multi protocol), instantiate 1 for
// each channel
module rx_reset_sm
(
input refclkdiv2,
input rst_n,
input [3:0] invValid,
input [3:0] rx_cdr_lol_ch_s,
input ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native ) using namespace std; const int MOD = 1000000007; const int UNDEF = -1; const int INF = 1 << 30; template <typename T> inline bool chkmax(T &aa, T bb)... |
`timescale 1ns / 1ps
`include "constants.vh"
//////////////////////////////////////////////////////////////////////////////////
// Company: TU Darmstadt
// Engineer: Mahdi Enan
//
// Create Date: 15:37:20 01/22/2017
// Design Name:
// Module Name: Permute
// Project Name: spongent
// Target Device... |
#include <bits/stdc++.h> using namespace std; long long add(long long a, long long b) { a += b; if (a >= 1000000007) a -= 1000000007; return a; } long long mul(long long a, long long b) { return ((a % 1000000007) * (b % 1000000007)) % 1000000007; } long long binary_expo(long long base, long ... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); if (n == 2) { printf( -1 n ); return 0; } printf( 6 n10 n15 n ); for (int i = 4; i <= n; i++) { printf( 6 ); for (int zero = 1; zero <= i - 4 + 1; zero++) printf( 0 ); printf( n ); } return 0; ... |
(** * ImpCEvalFun: Evaluation Function for Imp *)
(* #################################### *)
(** * Evaluation Function *)
Require Import Imp.
(** Here's a first try at an evaluation function for commands,
omitting [WHILE]. *)
Fixpoint ceval_step1 (st : state) (c : com) : state :=
match c with
| SKIP =>
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.