text stringlengths 59 71.4k |
|---|
module MUX8_1(Sel,S0,S1,S2,S3,S4,S5,S6,S7,out);
input [2:0] Sel;
input [7:0] S0,S1,S2,S3,S4,S5,S6,S7;
output [7:0]out;
assign out = (Sel[2])? (Sel[1]?(Sel[0]?S7:S6) : (Sel[0]?S5:S4)) : (Sel[1]?(Sel[0]?S3:S2) : (Sel[0]?S1:S0));
endmodule
module MUX4_1(Sel,S0,S1,S2,S3,out);
input [1:0] Sel;
input [7:0] S0,S1,S2,S3... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); int ans = 6; for (int i = 4; i <= n; i++) { ans += (i - 1) * i; } printf( %d n , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5, MX = 2e5, MN = 0; struct node; extern node* empty; struct node { int mx; node *LF, *RT; node() : mx(0), LF(this), RT(this) {} node(int val, node* lf = empty, node* rt = empty) : mx(val), LF(lf), RT(rt) {} }; node* e... |
module spi_slave(
input clk,
input rst,
input ss,
input mosi,
output miso,
input sck,
output done,
input [7:0] din,
output [7:0] dout
);
reg mosi_d, mosi_q;
reg ss_d, ss_q;
reg sck_d, sck_q;
reg sck_old_d, sck_old_q;
reg [7:0] data_d, data_q;
reg done_d, done_q;
reg [2:0] bit_ct... |
#include <bits/stdc++.h> using namespace std; int main() { int ans[] = {0, 1, 0, 18, 0, 1800, 0, 670320, 0, 734832000, 0, 890786230, 0, 695720788, 0, 150347555, 0}; int n; cin >> n; cout << ans[n] << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; int a[200007], b[200007]; bool check[200007]; int main() { string s; getline(cin, s); int res = 0; for (auto i = (0); i <= ((int)s.size() - 1); ++i) { int tmp = s[i]; int ans = 0; for (auto i = (1); i <= (8); ++i) { ans = 2 ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector ) using namespace std; string s; const int maxn = (int)1e5 + 1; const int maxlog = 19; struct vt { int w[26]; vector<int> lnk[26]; vector<int> rlnk[26]; string s; vt() {} vt(string s) : s(s) {} int get_cnt(in... |
#include <bits/stdc++.h> using namespace std; int n; struct node { int cnt; node* bit[3]; node() { bit[0] = bit[1] = NULL; cnt = 0; } }; node* root; void Insertt(int x) { node* cur = root; for (int i = 28; i >= 0; --i) { if (cur->bit[(x >> i) & 1] == NULL) cur->bit[... |
#include<bits/stdc++.h> typedef long long ll; using namespace std; const int MAXN = 5005; int tag[MAXN],s[MAXN]; ll dp[MAXN]; int main(){ ios::sync_with_stdio(false); int t;cin>>t; while(t--){ int n;cin>>n; for(int i=1;i<=n;i++){ cin>>tag[i]; } ... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/apu/apu_pulse.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that ... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > adj(500005); int visited[500005]; int counter; void dfs(int node, int color) { counter++; visited[node] = color; for (int i = 0; i < adj[node].size(); ++i) { if (visited[adj[node][i]] == 0) dfs(adj[node][i], color); } ... |
#include <bits/stdc++.h> using namespace std; int n, m, i, j, k = -1, c, d; int main() { scanf( %d%d , &n, &m); for (i = 1; i <= m; i++) { scanf( %d %d , &c, &d); if (k == -1 || (d - c + 1) < k) { k = d - c + 1; } } printf( %d n , k); c = 0; for (i = 1; i <= n; i+... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, v, a, b, x; cin >> n >> v; int mp[3002] = {0}; for (int i = 0; i < n; i++) { cin >> a >> b; mp[a] += b; } int prev = 0, ans = 0; for (int i... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; const int inf = 1e7; int tree[4 * N + 100], ans[2 * N + 100]; vector<int> R[N + 100], C[N + 100]; vector<pair<pair<int, int>, pair<int, int> > > qr[N + 100], qc[N + 100]; void update(int v, int tl, int tr, int idx, int val) { if (tl == t... |
module ERROR_OUTPUT_LOGIC #(
parameter [7:0] DATA_WIDTH = 1,
parameter [7:0] ADDR_WIDTH = 6
) (
input rst,
input clk,
input loop_complete,
input error_detected,
input [7:0] error_state,
input [ADDR_WIDTH-1:0] error_address,
input [DATA_WIDTH-1:0] expected_data,
input [DATA_WIDTH... |
#include <bits/stdc++.h> using namespace std; const int N = 100005, M = 500005; vector<int> gr[N], path, odd; pair<int, int> ed[M]; bool us[M]; void GetEulerCircuit(int u) { while (true) { while (!gr[u].empty() && us[gr[u].back()]) { gr[u].pop_back(); } if (gr[u].empty()) { ... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long fastexp(long long b, long long exp) { if (exp == 0) return 1; long long temp = fastexp(b, exp / 2); temp = (temp * temp) % 998244353; if (exp % 2 == 1) temp *= b; return... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: exam.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===================================... |
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; if (k == 2) puts( 1 1 ); if (k == 3) puts( 1 0 1 ); if (k == 4) puts( 0 0 1 1 ); if (k == 5) puts( 1 1 1 0 1 ); if (k == 6) puts( 1 0 0 1 1 1 ); if (k == 7) puts( 1 1 1 0 1 1 1 ); if (k == 8) puts( 1 0 0 ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:43:45 02/20/2015
// Design Name:
// Module Name: Fetch
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Wed Sep 20 21:09:46 2017
// Host : EffulgentTome running 64-bit major rele... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, cnt11 = 0, cnt10 = 0, cnt01 = 0; string s, t; cin >> n >> s >> t; for (int i = 0; i < 2 * n; ++i) { if (s[i] == 1 && t[i] == 1 ) ++cnt11; else if (s[i] == 1 ) ... |
/*
* These source files contain a hardware description of a network
* automatically generated by CONNECT (CONfigurable NEtwork Creation Tool).
*
* This product includes a hardware design developed by Carnegie Mellon
* University.
*
* Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University
*
* ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000005; const int MD = 1000 * 1000 * 1000 + 7; vector<int> g[maxn]; long long dp[maxn][2], mult[maxn][2], ans, cnt[maxn]; bool visited[maxn]; int binPow(int a, int b) { if (!b) return 1; if (b & 1) { return (1LL * binPow(a, b - ... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
//########################################################################
//# ELINK TX CONFIGURATION REGISTER FILE
//########################################################################
`include "elink_regmap.vh"
module etx_cfg (/*AUTOARG*/
// Outputs
cfg_mmu_access, etx_cfg_access, etx_cfg_packet, tx_enabl... |
#include<bits/stdc++.h> using namespace std; /* User Template @Shaurya Gautam CP.cpp */ /*****************************************/ #define ll long long #define vb vector<bool> #define vi vector<int> #define vl vector<long> #define vll vector<long long> #define vpii vector<pair<int, in... |
#include <bits/stdc++.h> using namespace std; int const nmax = 100000; int const domain = 1000000; struct Person { int x; int v; bool operator<(Person other) const { return (x < other.x); } }; int n, nl, nr; int s; Person pl[1 + nmax], pr[1 + nmax]; bitset<1 + domain> okl, okr; double ti... |
// 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 08 17:41:40 2017
// Host : GILAMONSTER running 64-bit major release (... |
// Copyright 2020-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... |
`timescale 1ns / 1ps
module test;
reg rst, clk;
wire wr_n, cen_fm, cen_fm2;
wire a0;
wire [7:0] din, dout;
initial begin
rst = 1'b0;
#300 rst=1'b1;
#3000 rst=1'b0;
end
initial begin
clk = 1'b0;
forever #10.417 clk=~clk; // 48MHz
end
jtframe_cen3p57 u_cen(
.clk ( clk ... |
#include <bits/stdc++.h> using namespace std; int main(void) { int lins, cols; cin >> lins >> cols; for (int i(0); i < lins; i++) { if (i % 2 == 0) { for (int j(0); j < cols; j++) { cout << # ; } cout << endl; } else if ((i + 1) % 4 == 0) { cout << ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; int dp[81][81][81][81]; vector<pair<int, int>> graph[81]; int solve(int v, int l, int r, int k) { if (k == 0) return 0; if (dp[v][l][r][k] != -1) return dp[v][l][r][k]; int &ret = dp[v][l][r][k]; ret = 1000000; for (auto e : graph[v]) { int... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03:05:03 06/28/2015
// Design Name:
// Module Name: nmievents
// Project Name:
// Target Devices:
// Tool versions:
// Description:
/... |
#include <bits/stdc++.h> using namespace std; const int size = 1000007; const long long modulo = 1000000007; const long long INF = 1e9; const double EPS = 1e-10; int main() { cin.sync_with_stdio(0); int n, m, k; cin >> n >> m >> k; int ans = 0; for (int i = 0; i < n; i++) { int a; ... |
#include <bits/stdc++.h> using namespace std; int z[2 * 1000 * 1000 + 10]; char s[2 * 1000 * 1000 + 10]; bool T[2 * 1000 * 1000 + 10]; int cnt[2 * 1000 * 1000 + 10]; int main() { int K, L; scanf( %d%d , &L, &K); scanf( %s , &s); for (int i = 1, l = 0, r = 0; i < L; ++i) { if (i <= r) z... |
/*
* 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 uiII = unsigned int long long; using II = int long long; using namespace std; const II N = 0x3f3f3f3f3f3f3f; int main() { vector<pair<II, II>> v; vector<pair<II, II>>::iterator it; v.reserve(1000000); II t, n, l, r, i(0); for (cin >> t; i < t; i++) { ci... |
#include <bits/stdc++.h> using namespace std; long long dx[] = {1, 0, -1, 0}; long long dy[] = {0, 1, 0, -1}; long long gcd(long long x, long long y) { if (y == 0) return x; else return gcd(y, x % y); } long long expo(long long n, long long m, long long p) { long long r = 1; n = ... |
`timescale 1ns / 1ps
module forwarding_unit (
input ex_mem_reg_write,
input mem_wb_reg_write,
input [4:0] ex_mem_dst_reg,
input [4:0] mem_wb_dst_reg,
input [4:0] id_ex_rs,
input [4:0] id_ex_rt,
input [4:0] if_id_rs,
input [4:0] if_id_rt,
output [1:0... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int num; int a = 0; int b = 0; int n; cin >> n; int sol[n]; for (a = 0; a < n; a++) { cin >> num; sol[num - 1] = (a + 1); } for (b = 0; b < n; b++) { cout << sol[b] << ; } return 0; } |
/*
* Copyright (c) 2015-2018 The Ultiparc Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list... |
#include <bits/stdc++.h> using namespace std; int n, l[200000 + 5], r[200000 + 5]; int p[200000 + 5], q[200000 + 5], sum; long long add(long long a, long long b) { return (a + b) % 1000000007; } long long mul(long long a, long long b) { return 1LL * a * b % 1000000007; } long long dec(long long a, long long... |
#include <bits/stdc++.h> using namespace std; struct my { int num; int dmg; } dmg[10010]; int mx, reg, rg[10010], n; int flag[10010]; vector<pair<int, int> > v; bool operator<(my a, my b) { if (a.dmg > b.dmg) return 1; return 0; } int main() { cin >> n >> mx >> reg; for (int i ... |
#include <bits/stdc++.h> using namespace std; int n, m, k, s, bigx[11], bigy[11], smlx[11], smly[11]; int main() { scanf( %d%d%d%d , &n, &m, &k, &s); for (int i = 1; i <= k; i++) bigx[i] = bigy[i] = -2020, smlx[i] = smly[i] = 2 * 2020; for (int i = 0; i < (n); i++) for (int j = 0; j < (m);... |
#include <cassert> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype> #include <vector> #include <string> #include <queue> #include <deque> #include <stack> #include <set> #include <map> #include <utility> #include <algorithm> #i... |
#include <bits/stdc++.h> using namespace std; queue<int> fila; struct G { double d; int m, p, r; } g[250002]; bool mk[250002]; int a2[9000000]; bool cmp2(int a, int b) { return g[a].d < g[b].d; } int pos = 0; int ind = 0; struct T { int m; int* e; void pdt(int a, int* b) { m = a,... |
#include <bits/stdc++.h> using namespace std; char st[8][20] = { err , monday , tuesday , wednesday , thursday , friday , saturday , sunday }; int main() { char s1[20], s2[20]; scanf( %s %s , s1, s2); int t1 = 0, t2 = 0; for (int i = 1; i <= 7; i++) if (strc... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Miguel Angel Rodriguez Jodar
//
// Create Date: 03:54:40 13/25/2015
// Design Name: SAM Coupé clone
// Module Name: samcoupe
// Project Name: SAM Coupé cl... |
#include <bits/stdc++.h> using namespace std; struct ball { float coord; int mass; float vel; short num; }; bool sort_num(ball a, ball b) { return a.num < b.num; } bool sort_coord(ball a, ball b) { return a.coord < b.coord; } void collide(ball &a, ball &b) { float temp = a.vel; a.vel... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, V = 1e5; inline int read() { register int x = 0, f = 0; register char c = getchar(); while (c < 0 || c > 9 ) f |= c == - , c = getchar(); while (c >= 0 && c <= 9 ) x = (x << 3) + (x << 1) + c - 0 , c = getchar(); ret... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_dp_array02.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it an... |
`timescale 1ns / 1ps
`include "riffa.vh"
module pcie_data_sender #(parameter C_PCI_DATA_WIDTH = 128, INPUT_DATA_WIDTH = 8, NUM_PES = 8) (
input clk,
input rst,
//Collector Interface
output coll_ready,
input coll_data_valid,
input[INPUT_DATA_WIDTH - 1:0] coll_da... |
#include <bits/stdc++.h> using namespace std; bool issquare(int n) { int sq = sqrt(n); if (sq * sq == n) { return true; } else { return false; } } int main() { long long int n; cin >> n; long long int ans = n; int f = 1; while (n != 1 and f == 1) { int sqr =... |
/*
* 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 OO = (int)1e9 + 1; const int MAX = 1e5 + 1; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, x, arr[3] = {}; cin >> n; for (int i = 0; i < n; i++) { cin >> x; arr[x]++; } if (!arr[1]) c... |
#include <bits/stdc++.h> using namespace std; int N, M, K; int Ar[110][110]; int Temp[110][110]; int Dn[110]; int Res = -1; int f() { int rev = 0; for (int i = 1, a, b; i <= N; i++) { a = 0; b = 0; for (int j = 1; j <= M; j++) { a += (Ar[i][j] == Dn[j]); b += (Ar[... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_never_unknown_async (reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
parameter propert... |
#include <bits/stdc++.h> using namespace std; const double long EPS = 1e-7; vector<vector<long long>> precost(long long n, vector<long long> &p, vector<long long> &id) { vector<vector<long long>> res(n, vector<long long>(n)); for (int i = 0; i < n; i++) { vector<l... |
/*
Copyright 2015, Google 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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int SIZE = 2e6 + 10; int a[SIZE]; int num[SIZE], nxt[SIZE]; int main() { int n, q; scanf( %d%d , &n, &q); long long sum = 0; for (int i = 0; i < (n); ++i) { scanf( %d , &(a[i])); sum += a[i]; a[i +... |
/*
* 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() { ios ::sync_with_stdio(0); cin.tie(0); long long n; int k; cin >> n >> k; long long num = 0; long long idx = 1; long long todie = n; for (int i = 0; i < k; ++i) { long long x; cin >> x; if (n % x < todie)... |
//////////////////////////////////////////////////////////////////////
//// ////
//// cpu_behavioral.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; const int N = 1003, INF = 0x3f3f3f3f; long long qpow(long long a, long long b) { long long ans = 1; while (b) { if (b & 1) ans = ans * a; a = a * a; b >>= 1; } return ans; } int n, m, k; int a[N][N]; int ans = 0; void dfs(in... |
#include <bits/stdc++.h> using namespace std; long long Hash(char* s, int sz) { const int p = 31; long long hash = 0, p_pow = 1; for (size_t i = 0; i < sz; ++i) { hash += (s[i] - a + 1) * p_pow; p_pow *= p; } return hash; } int gcd(int a, int b) { while (b) { a %= b; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:13:35 03/31/2015
// Design Name:
// Module Name: zlozony
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depende... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int r[105]; int i; double pi = acos(-1.0); for (i = 0; i < n; i++) { cin >> r[i]; } sort(r, r + n); int s = 0; for (i = 0; i < n; i++) { s = r[i] * r[i] - s; } printf( %.6lf n , s ... |
#include <bits/stdc++.h> using namespace std; template <class T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> T my_pow(T n, T p) { if (p == 0) return 1; T x = my_pow(n, p / 2); x = (x *... |
#include <bits/stdc++.h> using namespace std; int n, a; stack<int> q; vector<int> d; void insert(int x) { if (q.empty()) { q.push(x); return; } if (q.top() != x) { q.push(x); return; } q.pop(); insert(x + 1); } int main() { scanf( %d , &n); for (int ... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE AC 97 Controller ////
//// Serial Output Controller ////
//// ... |
#include <bits/stdc++.h> using namespace std; int n, V, A[64], B[64]; bool canCook(double x) { double tot = 0.0; for (int i = 0; i < n; i++) if (A[i] * x > B[i]) return 0; else tot += A[i] * x; return tot <= V; } double totalAmount(double x) { double tot = 0.0; ... |
#include <bits/stdc++.h> using namespace std; template <class P, class Q> inline bool mmin(P &a, Q b) { if (a > b) { a = b; return true; } return false; } template <class P, class Q> inline bool mmax(P &a, Q b) { if (a < b) { a = b; return true; } return false... |
/*
* 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) 2013, Stefan Kristiansson <>
* All rights reserved.
*
* Redistribution and use in source and non-source forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, th... |
#include <bits/stdc++.h> using namespace std; int main() { long long(n), (k); scanf( %lld%lld , &(n), &(k)); ; long long n2 = n; vector<long long> vec; while (n) { vec.push_back(n); if (n - 1 > 0) vec.push_back(n - 1); if (n - 2 > 0) vec.push_back(n - 2); if (n - 3 > ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int logb(int base, int x) { return (log(x) / log(base)); } int occurs(vector<long long> v, int n) { auto it = lower_bound(((v)).begin(), ((v)).end(), (n)); auto it1 = upper_bound(((v)).begin(), ((v)).end(), (n)); int x = it... |
#include <bits/stdc++.h> using namespace std; int main() { int R, C; cin >> R >> C; char m[R][C]; for (int i = 0; i < R; i++) for (int j = 0; j < C; j++) cin >> m[i][j]; for (int i = 0; i < R; i++) for (int j = 0; j < C; j++) { if (m[i][j] == S ) { if (i > 0) ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
// Copyright (c) 2000-2009 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, publ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:32:42 03/12/2013
// Design Name:
// Module Name: butterfly_unit_radix4
// Project Name:
// Target Devices:
// Tool versions:
// Description:
... |
// -----------------------------------------------------------------------
//
// Copyright 2004,2007-2008 Tommy Thorn - All Rights Reserved
//
// 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 Foun... |
`timescale 1ns / 1ps
module clock_get_all(input clk_origin, //需输入50MHz时钟,
input clkcnt_reset, //异步复位,低有效用于仿真
output out_clk_1khz, //对输入50k分频后输出时钟
output out_clk_100hz); //对输入时钟500k分频后输出
wire clk_1ms; //千分之一秒
wire clk_1cs; //百分之一秒
assign ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, x, sum = 0; long long int c[100009]; scanf( %lld %lld , &n, &x); for (i = 0; i < n; i++) { scanf( %lld , &c[i]); } sort(c, c + n); for (i = 0; i < n; i++) { sum = sum + c[i] * x; x--; i... |
//library ieee;
//use ieee.std_logic_1164.all;
//use ieee.std_logic_unsigned.all;
//-----------------------------------------------------
// Design Name : ram_dp_sr_sw
// File Name : ram_dp_sr_sw.v
// Function : Synchronous read write RAM
// Coder : Deepak Kumar Tala
//-----------------------------... |
#include <bits/stdc++.h> using namespace std; const int N = 2013; char p[1 << 20], s[205]; int k, n, m; int main() { gets(p); gets(s); cin >> k; n = strlen(p); m = strlen(s); string minLex; for (int i = 1; i <= k + 1; ++i) minLex += 1 ; int rboud = min(m, k), cntIn = n / k, R ... |
#include <bits/stdc++.h> using namespace std; signed long long n, m, answer; signed long long calc(signed long long n, signed long long m) { signed long long answer; if (m - n >= 1) { answer = n; } else { answer = m + (signed long long)ceil((sqrt(1.0L + 8.0L * (n - m)) - 1.0L) / ... |
/*
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
typedef int unit_type_t;
function [3:0] unit_plusone(input [3:0] i);
unit_plusone = i+1;
endfunction
package p;
typedef int package_type_t;
function ... |
module top(
input wire clk,
input wire rx,
output wire tx,
input wire [15:0] sw,
output wire [15:0] led
);
localparam NUM_FF = 4;
localparam FF_TYPE = "FDRE";
assign tx = rx;
// Generate some signals for the CE and reset lines.
wire ce = sw[14];
wire reset = sw[15];
wire [(4*NUM_FF)-1:0] Q;... |
#include <bits/stdc++.h> using namespace std; const int N = 503; int m, n, vis[N][N]; vector<int> adj[N * N]; void init() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int id(int x, int y) { return (x - 1) * n + y; } struct ds { char c; int x, y; }; vector<ds> V; void p... |
#include <bits/stdc++.h> using namespace std; const long long N = 3e5 + 10; long long n, m; long long res[N], sum[N], a[N]; long long len; struct Node { int x, p, id; } Q[N]; inline long long read() { long long x = 0, f = 0; char ch; while (((ch = getchar()) < 0 || ch > 9 ) && (ch != ... |
#include <bits/stdc++.h> using namespace std; const long long P = 998244353LL; const int N_MAX = 1e5 + 15; int A[N_MAX]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> A[i]; long long ans = 0LL; bool rem = 1; long long q = 1LL; while (rem) { long long t = 0L... |
#include <bits/stdc++.h> using namespace std; int d1[5], c1[5], d2[5], c2[5]; int min2[5], min1[5]; int main() { int n; cin >> n; for (int i = 1; i <= 4; i++) { cin >> c1[i] >> d1[i] >> c2[i] >> d2[i]; min1[i] = min(c1[i], d1[i]); min2[i] = min(c2[i], d2[i]); } int tmp = 1e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.