text stringlengths 59 71.4k |
|---|
/**
* 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() { string s; cin >> s; set<char> ss; map<string, bool> mp; long long l = 0; for (long long i = 0; i < s.size(); i++) { if (!mp[s]) l++; mp[s] = true; rotate(s.begin(), s.end() - 1, s.end()); } cout << l << endl... |
#include <bits/stdc++.h> using namespace std; int main() { double x, y, r, x1, y1; cin >> r >> x >> y >> x1 >> y1; double diam = 2 * r; double dist = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y)); int q = 0; if (dist == 0) { cout << 0 << endl; } else { while (dist >= diam) ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_a
//
// Generated
// by: wig
// on: Tue Jul 4 08:52:39 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author:... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; void solve() { long n, ans = 0; long count = 0; cin >> n; string s; cin >> s; while (s.size() && s[0] == s.back()) { count++; s.pop_back(); } if (s.empty()) { if (count <= 2) { cout << 0 << endl; return... |
#include <bits/stdc++.h> using namespace std; int main() { string in = 111 ; cin >> in; vector<vector<int>> result; set<int> last1, last0; for (int i = 0; i < in.size(); i++) { if (in[i] == 0 ) { if (last1.empty()) { result.push_back({i}); last0.insert(result.... |
//------------------------------------------------------------------------------
//
// Copyright 2011, Benjamin Gelb. All Rights Reserved.
// See LICENSE file for copying permission.
//
//------------------------------------------------------------------------------
//
// Author: Ben Gelb ()
//
// Brief Description:
//... |
`include "../../../rtl/verilog/gfx/gfx_wbm_read_arbiter.v"
module arbiter_bench();
// Clock
reg clk_i; // master clock reg
// Interface against the wbm read module
wire master_busy_o;
wire read_request_o;
wire [31:2] addr_o;
wire [3:0] sel_o;
reg [31:0] dat_i;
reg ack_i;
// Interfa... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; const int LOGN = 31; int fwt[MAXN]; int P[MAXN] = {0}; int n; void update(int v, int d) { v++; for (; v <= n; v += v & -v) fwt[v] += d; } int query(int v) { int sum = 0; for (; v > 0; v -= v & -v) sum += fwt[v]; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2014 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer _mode; initial _mode=0;
reg [7:0] a;
reg [7:0] b;
reg [7:0] c;
reg [7:0... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_outputcontrol.v ////
//// ////
//// This file is part of the Ether... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; int n, can_win[MAXN + 5], can_lose[MAXN + 5]; struct game { long long s, e; } a[MAXN + 5]; bool get_win(long long s, long long e) { assert(s <= e); if (e % 2 == 1) { if (s % 2 == 1) return 0; else ret... |
#include <bits/stdc++.h> using namespace std; int main() { long long x, y; cin >> x >> y; long long d = x * x + y * y; if (x == 0 || y == 0) { cout << black << endl; return 0; } for (long long i = 1; i <= 10000; i++) { if (d < i * i) { bool white = (i % 2 == 0 && ... |
/*
* Copyright (c) 2015 Steven Stallion
* 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 of cond... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T sqr(const T& a) { return a * a; } template <typename T> inline int sign(const T& a) { return a < 0 ? -1 : a > 0; } void task(); int main() { task(); return 0; } char dp[21][1 << 5][161050 + 10]; char par... |
// 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... |
/*
* 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... |
///////////////////////////////////////////////////////////////////////////////
// (c) Copyright 2008 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
//... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
/**
* 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; map<long long, long long> mp1, mp2; long long n, x, yy, c; vector<pair<int, int>> v; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> x >> yy; v.push_back({x, yy}); mp1[x + yy]++; mp2[x - yy]++; } for (int 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 la... |
//Legal Notice: (C)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 do... |
#include <bits/stdc++.h> using namespace std; long long freq[100005]; int32_t main() { long long n; cin >> n; string s; cin >> s; sort(s.begin(), s.end()); reverse(s.begin(), s.end()); cout << s[0]; for (long long i = 1; i < n; i++) { if (s[i] == 0 ) cout << s[i]; } ... |
#include <bits/stdc++.h> using namespace std; int ls[2005], rs[2005], fa[2005], sz[2005], z[2005]; int id, n, m, rt, mn, Sz; char s[10]; void getrt(int x, int F) { sz[x] = 1; int mx = 0; if (ls[x] && ls[x] != F && !z[ls[x]]) { getrt(ls[x], x); sz[x] += sz[ls[x]]; if (sz[ls[x]] > ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Outputs
q0, q1, q2, q3, q4, q5, q6a, q6b,
// Inputs
clk, d, rst0_n
... |
#include <bits/stdc++.h> using namespace std; int N; bool v[2001]; vector<int> G[2001]; int cnt = 0; int a[2001][2001]; int Dfn[2001], Low[2001]; int Dindex = 0; int Bcnt; bool instack[2001]; int Sta[2001]; int top = -1; void add(int x, int y) { G[x].push_back(y); } void read() { scanf( ... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); inline double cross(double x1, double y1010101010101, double x2, double y2) { return x1 * x2 + y1010101010101 * y2; } inline double len(double x, double y) { return sqrt(x * x + y * y); } inline double angle(double x1, double y101... |
#include <bits/stdc++.h> using namespace std; inline bool eq(double a, double b) { return fabs(a - b) < 1e-9; } const long long int inf = 1e15; inline int two(int n) { return 1 << n; } inline int test(int n, int b) { return (n >> b) & 1; } inline void set_bit(int& n, int b) { n |= two(b); } inline void un... |
/**
* 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() { double a, d, x, y, r; int i, n; scanf( %lf%lf%d , &a, &d, &n); for (i = 1; i <= n; i++) { r = fmod(i * d, 4 * a); if (r <= a) x = r, y = 0; else if (r <= 2 * a) x = a, y = r - a; else if (r <= 3 * a) ... |
#include <bits/stdc++.h> bool visit[201]; int main() { int n, k, a[201], i; scanf( %d%d , &n, &k); for (i = 0; i < n * 2 + 1; i++) scanf( %d , &a[i]); for (i = 0; i < n && k; i++) if (a[i * 2 + 1] > a[i * 2] + 1 && a[i * 2 + 1] > a[i * 2 + 2] + 1) { a[i * 2 + 1]--; k--; }... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; const int maxm = 100 + 10; const int inf = 0x3f; long long f[maxm][maxn], D[maxn], H[maxn], T[maxn], q[maxn]; long long g[maxn]; int N, M, P; long long A[maxn], S[maxn]; void init() { sort(A + 1, A + 1 + M); for (int i... |
#include <bits/stdc++.h> using namespace std; const int MXN = 1024 * 1024; int n; int k; int v[MXN]; int c[MXN]; int p[MXN]; pair<int, int> vstk[MXN]; pair<int, int> cstk[MXN]; int vn, cn; static pair<int, int> getxy(int iv) { int p1 = vstk[iv].first; auto cx = lower_bound(cstk, cs... |
// ----------------------------------------------------------------------
// 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:... |
module peripheral_pwm(clk , rst , d_in , cs , addr, d_out, mclk, ledres, ampPWM,ampSD);
input clk;
input rst;
input [15:0]d_in;
input cs;
input [3:0]addr; // 4 LSB from j1_io_addr
output [15:0]d_out;
output ledres;
output mclk;
output ampPWM;
output ampSD;
wire full;
wire empty;
wire dout... |
#include <bits/stdc++.h> #pragma GCC optimize(fast - math) using namespace std; long long powmod(long long a, long long b, long long mod) { if (b == 0 || a == 1) { if (mod == 1) return 0; else return 1; } if (b % 2 == 0) { long long k = powmod(a, b / 2, mod); re... |
#include <bits/stdc++.h> using namespace std; long long pwr(long long base, long long p, long long mod = (1000000007LL)) { long long ans = 1; while (p) { if (p & 1) ans = (ans * base) % mod; base = (base * base) % mod; p /= 2; } return ans; } long long gcd(long long a, long lon... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll base = 1000000007; int n; ll p2[1000000]; class reimu { public: ll sum, sum2; int sz; ll ans = 0; void operator+=(reimu x) { (sum2 += x.sum2) %= base; (sum += x.sum) %= base; sz += x.sz; } ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 500 + 5; const int mod = 26; long long qp(long long a, long long n) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } template <class T> inline bool... |
#include <bits/stdc++.h> using namespace std; long long s[1000], x[1000], size; void tob(long long a, long long arr[], long long& len) { len = 0; while (a != 0) { arr[len++] = a % 2; a /= 2; } } long long DP(long long n, long long carry) { if (n >= size) return 1 - carry; if (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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<vector<int> > adj(n, vector<int>(n, 0)); set<int> s; int x; for (int i = 2; i < n + 1; i++) { cin >> x; adj[x - 1][i - 1] = 1; s.inser... |
module top(
input ice_clk_i,
output [7:0] led_o,
output vs_o,
output hs_o,
output [3 : 0] red_o,
output [3 : 0] blue_o,
output [3 : 0] green_o
);
parameter WIDTH = 8;
wire clk_25;
reg [8 : 0] ctr = 3;
wire vs_valid;
wire hs_valid;
assign red_o = hs_val... |
#include <bits/stdc++.h> using namespace std; const long long maxN = 1e18; const long long minN = -1e18; const long long MOD = 1e9 + 7; const long long MOD1 = 998244353; const int baseHash = 331; const int bigNumLength = 5000; const long double PI = acos(-1); const long long limit = 2e5 + 5; const l... |
//////////////////////////////////////////////////////////////////////////////////
// NPCG_Toggle_MNC_getFT for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Ilyong Jung <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free soft... |
// 640 x 480 @ 60 Hz
// pixel clock: 25.157MHz
// 800 x 600 @ 60 Hz
// pixel clock: 40MHz
`timescale 1ns/1ns
module vga_display
(
input wire clk_pix,
input wire rst_n,
output wire vga_hs,
output wire vga_vs,
output wire vga_r,
output wire vga_g,
output wire vga_b
);
parameter VGA_MAX_H = 800;
... |
#include <bits/stdc++.h> using namespace std; bool used[10000005]; int ans[105]; bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) { if (a.first.second == b.first.second) return a.first.first < b.first.first; return a.first.second < b.first.second; } void solve() { int N; c... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { int y, a, b, c, d, temp; while (cin >> y) { temp = y + 1; while (temp != 0) { a = temp % 10; b = (temp % 100) / 10; c = (temp % 1000) / 100; d = temp / 1000; if (a == b || b == c || c == d || d == ... |
module axislave_stub (/*AUTOARG*/
// Outputs
s_axi_arready, s_axi_awready, s_axi_bid, s_axi_bresp, s_axi_bvalid,
s_axi_rid, s_axi_rdata, s_axi_rlast, s_axi_rresp, s_axi_rvalid,
s_axi_wready,
// Inputs
s_axi_aclk, s_axi_aresetn, s_axi_arid, s_axi_araddr, s_axi_arburst,
s_axi_arcache, s_axi_arlock, s... |
#include <bits/stdc++.h> using namespace std; string a, b; char s[200000], p[50]; int ans = 0; bool check(int l, int r) { int j = 1; for (int i = l; i <= r; ++i) { if (s[i] != p[j]) { return false; } j++; } return true; } int main() { std::ios::sync_with_stdio... |
#include <bits/stdc++.h> using namespace std; int n, p; double l[100100], r[100100], s[100100]; long long ans; double c; int main() { cin >> n >> p; for (int i = 0; i < n; i++) { cin >> l[i] >> r[i]; s[i] = 1 - (floor(r[i] / p) - ceil(l[i] / p) + 1) / (r[i] - l[i] + 1); } for (in... |
// // main.cpp // D - Epic Transformation // // Created by LiZnB on 2021/3/25. // #include <cstdio> #include <cstring> #include <algorithm> #define ls tree[pos].l #define rs tree[pos].r using namespace std; const int INF = 0x3f3f3f3f; const int N = 200000 + 10; int arr[N]; s... |
#include <bits/stdc++.h> using namespace std; struct t { char c; int a, b; t(char c, int a, int b) : c(c), a(a), b(b) {} t() {} }; int n; vector<t> e; double temp; double t0 = 1000; double gen_rand() { int x = rand() + 1, y = rand() + 1; x %= y; return x / (double)y; } in... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_buf_pdr.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/o... |
//==================================================================================================
// Filename : fifo.v
// Created On : 2015-01-07 21:57:26
// Last Modified : 2015-05-24 23:32:44
// Revision : 1.0
// Author : Angel Terrones
// Company : Universidad Simón Bolívar
// Ema... |
#include <bits/stdc++.h> using namespace std; static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; void solve4() { string s; cin >> s; int c = 0; int n = int((s).size()); for (char ch : s) { c += (ch == a ); } long long ans; cerr << n ... |
/*
* Testbench for simple 8-bit CPU.
* Copyright (C) 2015, 16 John Tzonevrakis.
* License exception for cpu_tb.v *ONLY*!
*
* This testbench is licensed under the terms of the ISC license:
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted,... |
/*
* 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; using ll = long long; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } template <class t> using v... |
#include <bits/stdc++.h> int main() { int x, y, n; int k, i, t; scanf( %d , &t); for (i = 0; i < t; i++) { scanf( %d %d %d , &x, &y, &n); if (n - n % x + y <= n) { k = n - n % x + y; } else { k = n - n % x - (x - y); } printf( %d n , k); } return 0... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Samuel A. Falvo II
//
// Create Date: 17:14:59 10/29/2011
// Design Name: UXA 1A
// Module Name: M_uxa_ps2_shfreg
// Project Name: Kestrel-2
// Target Devices: Nexys2
// T... |
/**
* 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... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: fifo32_shallow.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ========================================... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e4 + 10; int b[MAXN], n, a[MAXN]; int ID(int x) { x = x % n; if (x < 0) x += n; return x; } int main(void) { scanf( %d , &n); for (int i = 0; i < n; ++i) scanf( %d , a + i); vector<pair<int, int> > foo; for (int i = ... |
/*
* Copyright (c) 2015, Arch Laboratory
* 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 of con... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int INF = 1e9 + 7; const int N = 1010; const double pi = 3.1415926; int main() { char str[100010]; while (~scanf( %s , str)) { int len = strlen(str); int idx = INF, sum0 = 0, sum1 = 0; for (int 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 law... |
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)5e5 + 5; vector<int> edges[MAXN]; int n; int l[MAXN]; int r[MAXN]; int cur = 2; void go(int node, int p = 0) { int tt = 0; for (int i : edges[node]) { if (i == p) continue; tt++; } r[node] = cur + tt; int... |
#include <bits/stdc++.h> using namespace std; struct Point { long long x, y; Point() {} Point(long long a, long long b) : x(a), y(b) {} Point operator-(Point b) { return Point(x - b.x, y - b.y); } }; long long cross(Point x, Point y) { return x.x * y.y - x.y * y.x; } Point st[100005]; int to... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; long long x[300001]; long long p[300001] = {1}; int main() { std::ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> x[i]; p[i + 1] = p[i] * 2 % MOD; } sor... |
#include <bits/stdc++.h> using namespace std; int p[110]; int find(int v) { if (p[v] == v) return v; return p[v] = find(p[v]); } bool merge(int u, int v) { int x = find(u); int y = find(v); if (x != y) { p[x] = y; return true; } return false; } int main() { int ... |
#include <bits/stdc++.h> using namespace std; char str[100]; int L; bool ok(int n) { if (n == 0) return true; set<string> S; for (int i = 0; i + n <= L; i++) { string temp(str + i, str + i + n); if (!S.insert(temp).second) return true; } return false; } int main() { scanf... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Jafet Chaves Barrantes
//
// Create Date: 16:10:41 03/22/2016
// Design Name:
// Module Name: Clock_screen_top
// Project Name:
// Target Devices:
// Tool versions:
// Descripti... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; int ans1 = 0, ans2 = 0; int main(void) { int t, i, j; cin >> t; while (t--) { int n, mx = INT_MIN, ans = 0, sz; cin >> n; int a[n]; set<int> s; for (i = 0; i < n; i++) { cin >> a[i]; mx = max(mx, 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 la... |
#include <bits/stdc++.h> using namespace std; const int N = 501000; int n, a[N]; bool check(int p) { for (int i = p - 1; i >= 0; i--) { if (a[i] * 2 > a[n - p + i]) return false; } return true; } int work() { int l = 0, r = n >> 1; while (l <= r) { int mid = l + r >> 1; ... |
#include <bits/stdc++.h> using namespace std; struct FlowEdge { int to, cap, rev; FlowEdge(int to_, int cap_, int rev_) : to(to_), cap(cap_), rev(rev_) {} }; class FordFulkerson { public: FordFulkerson() {} FordFulkerson(int n) : G(n), used(n) {} void add(int from, int to, int cap) { ... |
#include <bits/stdc++.h> const double PI = acos(-1); const double EPS = 1e-6; const long long MOD = 998244353; const long long N = 30 + 10; template <typename T> inline T Abs(T x) { return x < 0 ? x * -1 : x; } template <typename T> inline T Max(T x, T y, T z) { return std::max(std::max(x, y),... |
`timescale 1ns / 1ps
/*
-- Module Name: Selector
-- Description: Seleccion de peticion activa para este ciclo de reloj.
El uso de algoritmos adaptativos o semi adaptativos
produce una o mas salidas validas para un paquete. Sin
embargo la solicitud de dos o mas puertos de salida a la
vez puede ocacion... |
#include <bits/stdc++.h> using namespace std; const int N = 3e4, INF = int(1e9) + 1, mod = 1e9 + 7; const long long BIG = 1e16; int n, d, a[N + 5], dp[N + 5][250 * 2 + 5]; bool w[N + 5][250 * 2 + 5]; int rec(int v, int l) { if (v > N) { return 0; } int l1 = l - (d - 250); if (w[v][l1])... |
#include <bits/stdc++.h> int main() { int n; std::cin >> n; long long sum = 0; int j; for (int i = 2; i <= n / 2; i++) { j = 2; while (i * j <= n) { sum += j; j++; } } sum = sum * 4; std::cout << sum; } |
/**
* 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() { string n; cin >> n; cout << 25 << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int n; int x_search(const int &down, const int &up, const int &c) { int l = down, r = up, key = 0; while (l <= r) { int mid = (l + r) / 2, cnt; cout << ? << mid << << 1 << << n << << n << n ; cin >> cnt; if (cnt >= c) {... |
module ultrasonic_control (
input clk ,
input enable ,
input signal ,
output reg start ,
output [15:0] value
) ;
reg [2:0] state ;
reg enableClk ;
reg rst_clk_n ;
reg rst_ult_n ;
wire [31:0] clkNumber ;
wire done ;
// Definición de estados
localparam S0 = 3'b000 ;
localparam S1 = 3'b001 ;
loca... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; long long dc(long long x, long long y) { long long r; while (y) { r = x % y; x = y; y = r; } return x; } int main() { cin >> n >> m >> k; if (2 * n * m % k != 0) cout << NO ; else { int ... |
#include <bits/stdc++.h> using namespace std; inline void OPEN(const string &s) { freopen((s + .in ).c_str(), r , stdin); freopen((s + .out ).c_str(), w , stdout); } int main() { int n; scanf( %d , &n); int art; scanf( %d , &art); int alex; scanf( %d , &alex); int ans[110... |
// 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; bool isSolveabe(int *a, int n, int m) { int i = m; int j = n - 1; int min = INT_MIN; while (i < j) { if (a[i] < a[j]) { if (a[i] < min) { return false; } min = a[i]; ++i; } else { if (a[j] < m... |
// diamond 3.7 accepts this PLL
// diamond 3.8-3.9 is untested
// diamond 3.10 or higher is likely to abort with error about unable to use feedback signal
// cause of this could be from wrong CPHASE/FPHASE parameters
module pll
(
input clock_in, // 50 MHz, 0 deg
output clock_out, // 200 MHz, 0 deg
output lo... |
/*
File: edistrib.v
This file is part of the Parallella Project.
Copyright (C) 2014 Adapteva, Inc.
Contributed by Fred Huettig <>
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, eith... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int n; long long power[300009], arr[300009]; long long len, l, r, ans, add; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } power[0] = 1;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.