text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10/12/2015 12:55:13 PM
// Design Name:
// Module Name: SerialHandler_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:40:46 12/20/2010
// Design Name:
// Module Name: clk_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> using namespace std; int a[100005], b[100005], m[100005]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) scanf( %d , &b[i]); m[1] = a[1] - b[1]; for (int i = 2; i <= n; i++) m[i] = m[i - 1] + a[i] ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int suma = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; suma += a[i]; } int half = 0; for (int i = 0; i < n; i++) { half += a[i]; if (half >= suma / 2 + suma % 2) { ... |
////////////////////////////////////////////////////////////////////////////////////////////////////
// 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 2
// of the License, or (at... |
// 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... |
/* This file is part of JT51.
JT51 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.
JT51 is distributed in the hope tha... |
//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> #pragma comment(linker, /stack:640000000 ) using namespace std; const double EPS = 1e-9; const int INF = 0x7f7f7f7f; const double PI = acos(-1.0); template <class T> inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd((b), ((a) % (b))); } template <class T> inline T lc... |
//MODULE REFERENCE
`define tenv_clock tenv_clock
`define tenv_descstd_device tenv_descstd_device
module tenv_usbdev #(parameter DATA_MAXSIZE=64);
//IFACE
reg rst0_async=1;
reg rst0_sync=1;
wire[1:0] trsac_type;
localparam TYPE_SETUP=0... |
//-----------------------------------------------------------------------------
//
// (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... |
/**
* 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) 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
//
//... |
/*
* File Name : tb.v
* Version : 0.1
* Date : Feb 27, 2008
* Description : jhash input modules testbench
* Dependencies :
*
* Company : Beijing soul
* Author : Hu Gang
*
*******************************************************... |
`define WIDTH_P 2
/**************************** TEST RATIONALE *******************************
1. STATE SPACE
This module generates gray codes of every possible binary number of WIDTH_P
and feeds these vales as test inputs to the DUT. An up-counter is used to
generate the binary numbers whose gray codes are t... |
#include <bits/stdc++.h> using namespace std; vector<long long> bitr; void update(long long ind, long long val, long long n) { long long i = ind + 1; while (i <= n) { bitr[i] += val; i += i & (-i); } } long long sum(long long ind) { long long i = ind + 1; long long ans = 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... |
// File generic.vhd translated with vhd2vl v2.4 VHDL to Verilog RTL translator
// vhd2vl settings:
// * Verilog Module Declaration Style: 1995
// vhd2vl is Free (libre) Software:
// Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd
// http://www.ocean-logic.com
// Modifications Copyright (C) 2006 Mark... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.1
// Ultra-Embedded.com
// Copyright 2011 - 2014
//
// Email:
//
// ... |
/**
* Hydra - An open source strand lighting controller
* (c) 2013-2014 Jon Evans <>
* Released under the MIT License -- see LICENSE.txt for details.
*
* strand_driver.v - WS2801/WS2811 driver state machine
*
* Input clock is assumed to be 100 MHz, giving the following timings:
* WS2811 T0H = 50, T0L = 200, T1H... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, a, b; cin >> n >> a >> b; ll tot = 6 * n; ll ans = 1e18; if (a * b >= tot) { cout << a * b << n << a << << b << n ; } else... |
#include <bits/stdc++.h> const int N = 1e6 + 10; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; const double eps = 1e-8; const double pi = acos(-1); using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { 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... |
module sine_lut(addr, s);
input [7:0] addr;
output [7:0] s;
reg [7:0] s;
always @(addr) begin
case (addr)
0: s = 8'h80;
1: s = 8'h83;
2: s = 8'h86;
3: s = 8'h89;
4: s = 8'h8C;
5: s = 8'h8F;
6: s = 8'h92;
7: s = 8'h95;
8: s = 8'h98;
9: s = 8'h9B;
10: s = 8'h9E;
11: s = 8'hA2;
12: s = 8'hA5;
13: s = 8'hA7;
14: s = 8'h... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 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 dis... |
#include <bits/stdc++.h> using namespace std; int a[6]; int sum = 0; int x, y, z; int x1, adjf, z1; int main() { ios_base::sync_with_stdio(false); cin.tie(0); scanf( %d%d%d , &x, &y, &z); scanf( %d%d%d , &x1, &adjf, &z1); for (auto i = 0; i != 6; i++) scanf( %d , &a[i]); if (y < 0) {... |
#include <bits/stdc++.h> using namespace std; struct Grass { int sizee; char dir; } a[100005]; int n; bool flag[100005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].dir; } for (int i = 1; i <= n; i++) { cin >> a[i].sizee; } int nowx = 1; ... |
#include <bits/stdc++.h> int* array; int f(int index) { if (array[index] == -1) { array[index] = index; return index; } if (array[index] == index) return index; int r = f(array[index]); array[index] = r; return r; } int main() { int n, m; scanf( %d %d , &n, &m); i... |
#include <bits/stdc++.h> using namespace std; signed main() { long long n; cin >> n; long long a[n]; long long sum = 0; for (long long i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } long long req = ceil(4.5 * n) - sum; vector<long long> b(n); for (long long i = 0; 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... |
/**
* 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... |
//#############################################################################
//# Function: Clock domain crossing FIFO #
//#############################################################################
//# Author: Andreas Olofsson #
... |
// Beck Pang
// University of Washington, Seattle
// Apr. 6th, 2015
// EE 471, Lab 1
`include "DFlipFlop.v"
`include "JohnsonCounter.v"
// test bench running on gtkwave
module JohnsonCounter_testBench ();
// connext the two modules
wire clk, rst_n;
wire [3:0] out;
// declare an instance of the AND module
Johns... |
#include <bits/stdc++.h> using namespace std; const long long N = 5e5 + 1, mod = 1e9 + 7, base = 17; int n, m, d, c, up; int f[N]; int sum[N]; int it[N * 4]; int common[N]; int small[N * 2]; int tmp[N]; int flag[N * 2][30]; unsigned long long hashes[N]; long long pw[N]; string srr; vector<in... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; vector<long long> v, v1; map<long long, long long> m; for (long long i = 0; i < n; i++) { long long a; cin >> a; v.push_back(a); } long long a, c = 0; cin >> a; for (long l... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const long double pi = 3.14159265358979323846; long long MOD = 1e9 + 7; const char nl = n ; const long long inf = 1e15; long long nxt() { long long x; cin >> x; return x; } long long mul(long long x, long long y) { return (1ll * (x % MOD) *... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<long long> ar(n + 1, 1e10); vector<long long> cur(n + 1, 1); for (long long i = 1; i <= n; i++) { cin >> ar[i]; if (ar[i] == ar[i - 1]) cur[i] = cur[i - 1] + 1; } long long ans = 0; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10.03.2017 09:19:09
// Design Name:
// Module Name: sine
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision... |
module tb_gmii2fifo9();
/* 125MHz system clock */
reg sys_clk;
initial sys_clk = 1'b0;
always #8 sys_clk = ~sys_clk;
/* 33MHz PCI clock */
reg pci_clk;
initial pci_clk = 1'b0;
always #30 pci_clk = ~pci_clk;
/* 62.5MHz CPCI clock */
reg cpci_clk;
initial cpci_clk = 1'b0;
always #16 cpci_clk = ~cpci_clk;
/* 125MHz RX... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.3 (lin64) Build Fri Oct 3 16:31:15 MDT 2014
// Date : Sun Oct 25 15:41:08 2015
// Host : arthas-ubuntu running 64-bit Ubuntu 14.04.3... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/unisims/SRL16E.v,v 1.7 2005/03/14 22:32:58 yanx Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
////////////////////////////////////////////////////... |
/*************************************************************************
* *
* Copyright (C) 2016,2017 Alves, Fredy. *
* All rights reserved. Email: *
* ... |
#include <bits/stdc++.h> using namespace std; int sum[1000000 + 10][27]; char c1[1000000 + 10], c2[1000000 + 10]; long long n, m; long long len1, len2; long long gcd(long long a, long long b) { long long t = a; while (b) { a = b; b = t % b; t = a; } return a; } int main... |
/*
* 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; pair<int, int> V[2001010]; int cnt[2002]; long long cum[2002], N; string s; void make(int l, int r) { while (l >= 0 && r < (int)s.size()) { if (s[l] == s[r]) { V[N++] = (make_pair(l, r)); cnt[l]++; } else break; l--,... |
#include <bits/stdc++.h> using namespace std; long long int n; int main() { scanf( %lld , &n); if (n == 1 || n == 3 || n == 4 || n == 6 || n == 9 || n == 12) { cout << 0 << endl; return 0; } int mod = n % 3, mx; if (mod == 2) { for (long long i = 1e7; i >= 1; i -= 3) { ... |
#include <bits/stdc++.h> using namespace std; const long long N = 1005; long long n, m, q, ans; bool vizitat[N][N]; long long dp[N][N][2]; bool verifica(long long i, long long j) { if (i < 1 || j < 1 || i > n || j > m) return false; return true; } long long cnt(long long i, long long j) { lo... |
////////////////////////////////////////////////////////////////////////////////
//
// PS2-to-SAM Mouse
// (C) 2016 Sorgelig
//
// 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; eit... |
#include <bits/stdc++.h> using namespace std; int main() { int a[60], i, x, n, k; cin >> n >> k; for (i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); if ((n + 1 - k) >= 1) cout << a[n + 1 - k] << << a[n + 1 - k]; else cout << -1 ; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 50; const int INF = 0x3f3f3f3f; struct node { int to, next; } edge[maxn * 3]; struct Node { int id; long long val; bool operator<(const Node& a) const { return val < a.val; } }; int head[maxn], cnt, d[maxn], depth[maxn]... |
//////////////////////////////////////////////////////////////////////
//// ////
//// spi_slave_model.v ////
//// ////
//// This file is part of the SPI 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:10:52 08/30/2014
// Design Name:
// Module Name: lab4dpath
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
/**
* 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... |
// DESCRIPTION: Verilator: SystemVerilog interface test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
logic rst = 1'b1; // reset
integer rst_cnt = 0;
// reset is removed a... |
#include <bits/stdc++.h> using namespace std; int a[212345]; int cnts[212345]; int lft[212345]; int rght[212345]; int cumsum[212345]; int get_right_ans(int i) { return cumsum[rght[i]] - cumsum[i]; } int get_left_ans(int i) { if (lft[i]) return cumsum[i - 1] - cumsum[lft[i] - 1]; return cumsum[i ... |
module mem_arbiter(
output wire[31:0] out_address,
output wire[31:0] out_din,
output wire out_re,
output wire out_we,
input wire[31:0] os_address,
input wire[31:0] os_din,
input wire os_re,
input wire os_we,
input wire[31:0] mfind_address,
input wire[31:0] mfind_din,
input wire mfind_re,
input wire mfin... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int main() { int t; int n, m; long long s = 0; cin >> n >> m; vector<long long> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; } s += (a[0] - 1); for (int i = 1; i < m; i++) { if (a[i] >= a[i -... |
//
// 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... |
#include <bits/stdc++.h> using namespace std; int n; vector<pair<int, int>> vp; int chk() { bool ok = true; int d = vp[2].first - vp[1].first; for (int i = 2; i < n; i++) if (vp[i].first - vp[i - 1].first != d) ok = false; if (ok) { printf( %d n , vp[0].second + 1); exit(0); ... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int main() { int n, k; scanf( %d %d , &n, &k); vector<int> A(n), acc(n); for (int i = (0); i < (n); ++i) cin >> A[i]; acc[0] = A[0]; for (int i = (1); i < (n); ++i) acc[i] = A[i] + acc[i - 1]; int rsp = -inf; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, odd, up, down; odd = up = down = 0; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] % 2 != 0) odd++; } for (int i = 0; i < n; i++) { if (a[i] % 2 == 0) cout << a[i] / 2 << ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_zzctu_sync.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... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 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 distributed ... |
#include <bits/stdc++.h> using namespace std; struct node { int l; int r; } a[200005], b[2000005]; int cmpl(struct node n, struct node m) { return n.l < m.l; } int cmpr(struct node n, struct node m) { return n.r < m.r; } int main() { int n, m; while (~scanf( %d , &n)) { int sum = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int a, b, ans = 0; cin >> a >> b; ans = min(a, b); ans = min(ans, (a + b) / 3); cout << ans << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; #define l1 long long int #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define test l1 t;cin>>t;while(t--) // Function to check // if parentheses are balanced bool isBalanced(string exp) { // Initialising Variabl... |
/**
* 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, m; long long k, wyn; long long tab[27][27]; map<long long, long long> odp[27][27]; void back1(int, int, long long); void back2(int, int, long long); int main() { ios_base::sync_with_stdio(0); cin >> n >> m >> k; for (int i = 1; i <= n; i++... |
#include <bits/stdc++.h> using namespace std; int n, ini_pos; vector<int> v[2020]; int a[2020], MAX; map<int, int> mp; int dist(int a, int b) { if (a < b) swap(a, b); return min(a - b, n - a + b); } void input() { scanf( %d %d , &n, &ini_pos); for (int i = 1; i <= n; i++) scanf( %d , a +... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time ba... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
#include <bits/stdc++.h> using namespace std; map<string, int> id; inline int getID(string s) { if (id.find(s) == id.end()) { int sz = id.size(); id[s] = sz; } return id[s]; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, a, b, k, f; cin >> n >> a >>... |
#include <bits/stdc++.h> using namespace std; const int N = 5e6 + 50; vector<int> v; int vis[N] = {0}, n; int flag[N] = {0}, ans = 0; void dfs(int k) { if (vis[k]) return; vis[k] = 1; if (flag[k]) dfs(k ^ ((1 << n) - 1)); for (int i = 0; i < n; i++) if ((1 << i) & k) dfs(k ^ (1 << i));... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 5, LOG = 19, off = 1 << 19; pair<int, int> t[LOG][2 * off]; void upd(int x, pair<int, int> p, int lg) { for (x += off; x; x /= 2) { t[lg][x].first = min(t[lg][x].first, p.first); t[lg][x].second = max(t[lg][x].second, p.second)... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; pair<long long, long long> a[n]; for (long long i = 0; i < n; i++) { cin >> a[i].first; a[i].second = i + 1; } sort(a, a + n); long long mx = 0, mx_start = 0, mx_end = 0; long long j; lo... |
#include <bits/stdc++.h> using namespace std; double dp[2][605]; int main() { int n, k; scanf( %d%d , &n, &k); int pre = 0, cur = 1; for (int i = 0; i < n; ++i) { memset(dp[cur], 0, sizeof dp[cur]); for (int j = 1; j < 600; ++j) dp[cur][j] += (1. * j / k / (j + 1) + (k - 1.) / ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 51, MOD = 998244353, INVP = 828542813; struct Matrix { int num[2][2]; Matrix() { memset(num, 0, sizeof(num)); } inline int *operator[](const int &x) { return num[x]; } inline const int *operator[](const int &x) const { return num... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string a; cin >> a; if (a.size() > 26) { cout << -1 n ; } else { int count = 0; int hash[26] = {0}; for (int i = 0; i < a.size(); i++) { if (hash[a[i] - 97]) count++; ... |
#include <bits/stdc++.h> using namespace std; template <class X, class Y> void minimize(X &x, const Y &y) { if (x > y) x = y; } template <class X, class Y> void maximize(X &x, const Y &y) { if (x < y) x = y; } template <class T> T Abs(const T &x) { return (x < 0 ? -x : x); } const int ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int tt; cin >> tt; while (tt--) { int a, b, c, saveb = 0; string st, md, en; st = md = en = ; cin >> a >> b >> c; bool ub = false; while (b) { if (!ub) { ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 2000000000000000000; long double eps = 1e-12; long long t, n, m, a; vector<long long> vec; void Stefan() { cin >> n >> m; long long cur = 1; for (int i = 0; i < n; i++) { cin >> a; vec.push_back(a); } if (n >... |
module VGA_Ctrl ( // Host Side
iRed,
iGreen,
iBlue,
oCurrent_X,
oCurrent_Y,
oAddress,
oRequest,
// VGA Side
oVGA_R,
oVGA_G,
oVGA_B,
oVGA_HS,
oVGA_VS,
oVGA_SYNC,
oVGA_BLANK,
oVGA_CLOCK,
// Control Signal
iCLK,
... |
`timescale 1ns / 1ps
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: capture_fifo.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
//
// =========================... |
#include <bits/stdc++.h> using namespace std; const int N = 600010; const int Mod = 998244353; inline int sub(int x, int y) { return (x - y < 0 ? x - y + Mod : x - y); } inline int add(int x, int y) { return (x + y >= Mod ? x + y - Mod : x + y); } int po(int x, int y) { int r = 1; for (; y; y >>= 1,... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { if (n == 1) cout << 8 << endl; else if (!n) cout << 1 << endl; else if (n % 4 == 0) cout << 6 << endl; else if (n % 4 == 1) cout << 8 << endl; else if (n % 4 == ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(), cout.tie(); int n; cin >> n; int temp = 1; int a[] = {4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777}; for (int i = 0; i < 14; i++) { if (n % a[i] == 0) { cout <... |
#include <bits/stdc++.h> using namespace std; pair<int, int> arr[1000005]; int par[1000005], sz[1000005]; int find(int x) { if (par[x] != x) par[x] = find(par[x]); return par[x]; } void Union(int a, int b) { a = find(a); b = find(b); if (a != b) { par[a] = b; sz[b] += sz[a]; ... |
#include <bits/stdc++.h> using namespace std; int n; int l[305]; int c[305]; map<pair<int, int>, long long int> m; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } long long int solve(int i, int g) { if (g == 1) return 0; if (i == n) { if (g != 1) return (long long int)1000000000... |
#include <bits/stdc++.h> int n, a, b, p; char s[51]; int main(void) { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d %s , &a, s); b = 0; p = a / 2; for (int j = 0; j < a; j++) { if (s[j] == ( ) { b++; } else { if (b > 0) { ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; int n; int main() { cin >> n; for (int i = 2; i * i <= n; i++) { if (n % i != 0) continue; int m1 = i; for (int z1 = 1; z1 < m1; z1++) { int val = n - 1 - z1 * (n / i); if (val > 0 && val % m1 ... |
/******************************************************************************/
/* Top module of sorting logic Ryohei Kobayashi */
/* 2015-08-01 */
/****************************************************************************... |
#include <bits/stdc++.h> using namespace std; const int mxn = 2e5 + 5; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; int tc; cin >> tc; while (tc--) { string s; cin >> s; int a = 0, b = 0, c = 0; for (int i = 0; i < s.size(); i++) { if (s... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); if (n % 3 == 0 || n % 3 == 1) { cout << 1 << << 1 << << n - 2; } else { cout << 1 << << 2 << << n - 3; } return 0; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Samuel A. Falvo II
//
// Create Date: 19:59:06 10/30/2011
// Design Name: UXA 1A
// Module Name: M_uxa_ps2
// Project Name: Kestrel-2
// Target Devices: Nexys2
// Tool versions:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.