text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; long long mod = 998244353; long long binpow(long long a, long long p) { return p ? binpow(a * a % mod, p >> 1) * (p & 1 ? a : 1) % mod : 1; } long long bininv(long long a) { return binpow(a, mod - 2); } set<int> solved; map<long long, vector<long long> > m... |
#include <bits/stdc++.h> using namespace std; const int M = 998244353; int n; vector<int> v; vector<set<int> > g; int all[300011] = {}; set<pair<int, int> > ed; pair<int, int> DFS(int u, int p) { pair<int, int> ret(v[u], 1); if (v[u] == 0) ret = {-1, 0}; for (auto v : g[u]) if (v != p)... |
#include <bits/stdc++.h> using namespace std; int n, deg[100100], t[100100], legs[100100]; vector<int> adj[100100]; void dfs(int x, int px) { t[x] = 1; for (int i = 0; i < adj[x].size(); i++) { int u = adj[x][i]; if (u == px) continue; if (deg[u] <= 2) dfs(u, x); } } int main()... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 * 100 + 10; vector<int> g[maxn]; int a[maxn], b[maxn]; bool p[maxn]; int n, m; void input() { cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--, v--; g[u].push_back(v); g[v].pu... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 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
//
//... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int counter = 0; for (int i = 0; i < n; i++) { int j = 0; for (j = i + 1; j < n; j++) { if (s[j] == s[i]) counter++; else { break; } }... |
/**
* 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; using ll = long long; using ld = long double; mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi = acos(0) * 2; template <typename T> inline void read(T &x) { char c; bool nega = 0; while ((!isdigit(c = get... |
/*
* VGA 800x480 screen
*
* The screen I'm using
* http://www.amazon.co.uk/gp/product/B00IR5VRS4?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s01
*/
module vga_demo
(
CLOCK_PIXEL,
RESET,
VGA_RED,
VGA_GREEN,
VGA_BLUE,
VGA_HS,
VGA_VS,
BLANK_N
... |
#include <bits/stdc++.h> using namespace std; inline long long bip(long long x, long long n, long long mod) { long long res = 1; while (n) { if (n & 1) { res = (res * x) % mod; } x = (x * x) % mod; n >>= 1; } return res; } const int maxn = INT_MAX; const long lo... |
#include <bits/stdc++.h> using namespace std; bool Pfunc(string); int main() { string st; cin >> st; for (int i = st.size(); i > 0; i--) { bool b = false; for (int k = 0; k <= st.size() - i; k++) { if (Pfunc(st.substr(k, i)) == false) { cout << i; b = true; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; for (int i = (0); ((1) > 0 ? i < (t) : i > (t)); i += (1)) { ll n, s; cin >> n >> s; vector<ll> v(n), pref(n + 2); for (... |
// ==============================================================
// 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 1 ns / 1 ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 24.06.2017 01:51:37
// Design Name:
// Module Name: mostrar_numeros_pantalla
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependenci... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, temp; cin >> n; temp = n; vector<pair<long long, int> > v; for (int i = 2; i <= sqrt(n); i++) { int count = 0; while (temp % i == 0) { temp /= i; count++; } if (count != 0) v.push_back... |
/*
* 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; bool hell(vector<int>& v1, vector<int>& v2) { return v1.size() < v2.size(); } int main() { int n; cin >> n; vector<vector<int> > f(100); int a[2 * n + 1]; for (int i = 1; i <= 2 * n; i++) { cin >> a[i]; f[a[i]].push_back(i); } i... |
module sound (switches, clock50, clock2_50, key, fpga_i2c_sclk, fpga_i2c_sdat, aud_xck,
aud_daclrck, aud_adclrck, aud_bclk, aud_adcdat, aud_dacdat);
input clock50, clock2_50;
input [3:0] switches;
input [0:0] key;
// I2C Audio/Video config interface
output fpga_i2c_sclk;
inout fpga_i2c_s... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > ad(123456); vector<int> vis(123456, 0), par(123456, -1), hc(123456, 0), hp(123456, 0), v(123456, 0); void dfs(int s) { int i, a, x = ad[s].size(), y = 0; for (i = 0; i < x; i++) { a = ad[s][i]; if (vis[a] == 0) par[a] =... |
/**
* 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)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e7 + 1; int32_t main() { long long n; cin >> n; if (n % 2) cout << 1; else cout << 2; } |
/*
* 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; const long long BIG = 1000000007; const double PI = 3.141592653589793238; template <typename T, typename Q> T max(T a, Q b) { if (a < b) return b; return a; } template <typename T, typename Q> T min(T a, Q b) { if (a > b) return b; return a; ... |
/*
* 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 fx[] = {+1, -1, +0, +0}, fy[] = {+0, +0, +1, -1}; const long long mod = 1e9 + 7, INF = 1e18, mx = 1e6; int Case = 1, cas = 0; long long n, A[mx], Sum; int main() { ios_base ::sync_with_stdio(0), cin.tie(0); ; cin >> n; for (int i = 1; i... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/06/05 22:54:09
// Design Name:
// Module Name: flow_led_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 2013 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 proper... |
#include <bits/stdc++.h> using namespace std; void work(long long ang) { for (long long n = 3;; n++) { if (ang * n % 180 == 0) { if (ang * n / 180 <= n - 2) { printf( %I64d n , n); return; } } if (n == 998244353) break; } } int main() { int T; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; char g[N][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { long double h, c, t; cin >> h >> c >> t; if (t >= h) { cout << 1 n ; continue; } ... |
// -- (c) Copyright 2011 - 2012 Xilinx, Inc. All rights reserved.
// --
// -- This file contains confidential and proprietary information
// -- of Xilinx, Inc. and is protected under U.S. and
// -- international copyright and other intellectual property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
module user_design(clk, rst, exception, input_timer, input_rs232_rx, input_ps2, input_i2c, input_switches, input_eth_rx, input_buttons, input_timer_stb, input_rs232_rx_stb, input_ps2_stb, input_i2c_stb, input_switches_stb, input_eth_rx_stb, input_buttons_stb, input_timer_ack, input_rs232_rx_ack, input_ps2_ack, input_i2... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_clk_cclk_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 ... |
(****************************************************************************)
(* Copyright 2020 The Project Oak Authors *)
(* *)
(* Licensed under the Apache License, Version 2.0 (the "License") *)
(* y... |
#include <bits/stdc++.h> using namespace std; int t; string s; int main() { cin >> t; while (t--) { cin >> s; int n = s.size(); int ans = n + 1, l = 0, c[4] = {0}; for (int i = 0; i < n; i++) { c[s[i] - 0 ]++; while (c[1] > 0 && c[2] > 0 && c[3] > 0) { ... |
#include <bits/stdc++.h> using namespace std; int n, m, k; int main() { scanf( %d %d %d , &n, &m, &k); for (int i = 0; i < k; ++i) { int x, y; scanf( %d %d , &x, &y); x = min(x - 1, n - x); y = min(y - 1, m - y); if (min(x, y) <= 4) { printf( YES ); return 0; ... |
#include <bits/stdc++.h> using namespace std; namespace Base { const int inf = 0x3f3f3f3f, INF = 0x7fffffff; const long long infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll; template <typename T> void read(T &x) { x = 0; int fh = 1; double num = 1.0; char ch = getchar(); while... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n, k; cin >> n >> k; long long int cost = 0, ans = 0, a[n]; vector<pair<long long int, long long int>> pr(n); for (long long int(i) = 0; (i) < (n);... |
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll sum(ll n) { ll s=0; while(n>0) { s+= n%10; n=n/10; } return s; } ll gcd(ll n, ll m ) { ll k = n%m; while(k!=0) { n=m; m=k; ... |
// 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 : Tue Sep 19 09:38:58 2017
// Host : DarkCube running 64-bit major release ... |
// 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 : Tue May 30 22:27:54 2017
// Host : GILAMONSTER running 64-bit major release (... |
module draw_block(
input clock,
input [10:0] vcounter,
input [11:0] hcounter,
input [2:0] block,
output [4:0] sel_row, sel_col,
output reg [3:0] out
);
parameter LEFT = 160;
parameter TOP = 0;
parameter MAXX = 320;
parameter MAXY = 480;
wire range;
assign range = hcounter >= LEFT && hcounter < LEFT+MAXX && vcou... |
#include <bits/stdc++.h> using namespace std; const int N = 100500; bool w, w1; int main() { srand(time(NULL)); int n, m, mn, mx; cin >> n >> m >> mn >> mx; for (int i = 1; i <= m; i++) { int x; cin >> x; if (mn > x || mx < x) cout << Incorrect , exit(0); if (x == mn) w ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n, T, a, b; cin >> n >> T >> a >> b; vector<pair<int, int>> qstn(n); int totA = 0, totB = 0; for (auto& i : qstn) { cin >>... |
/**
* 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() { long long n, i, j, s, r, m, ans; string x; cin >> n >> m; long long a[n + 1][m + 1]; for (i = 1; i <= n; i++) { if (i % 2 == 1) { for (j = 0; j < m; j++) a[i][j] = 0; } else { for (j = 0; j < m; j++) a[i][j] =... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; } inline int readChar(); template <class T = int> inline T readInt()... |
#include <bits/stdc++.h> using namespace std; int n, t1, t2, t3, t4, t5, dif, yes, rep, cnt[1005], last[1005], ans[1005][1005], ma[1005][1005]; vector<int> nod, re, v[1005]; vector<pair<int, int> > path, more; vector<pair<pair<int, int>, int> > sol; bool vis[1005]; pair<int, int> pl, pr; bool ok; ... |
/**
* 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... |
// $Id: c_select_1ofn.v 1534 2009-09-16 16:10:23Z dub $
/*
Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x60000000; const int MINF = -1000000000; const int mod = 99999997; const long long cons = 100000; const double pi = 3.141592653589793; int lim; int p[100005][20]; int depth[100005]; pair<int, int> dmax[100005][3]; int up[100005][20]; ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int n, i, j, x, y, a[100005], v[100005]; map<long long int, long long int> ma; cin >> n; for (i = 1; i <= n; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int onexor = 0; bool ok = true; long long s, x; cin >> s >> x; for (int i = 40; i >= 0; i--) { if (s & (1LL << i)) { if (x & (1LL << i)) { continue; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:41:59 02/07/2016
// Design Name: bcdAdder
// Module Name: F:/VLSI Lab/bcdAdder/bcdAdderTest.v
// Project Name: bcdAdder
// Target Device:
// Tool versions:
//... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, m, i, min, count, a[101], sum, count0; cin >> t; while (t--) { cin >> n >> m; count = 0; sum = 0; count0 = 0; for (i = 0; i < (n * m); i++) { cin >> a[i]; if (a[i] < 0) { count++;... |
/**
* 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; using ll = long long; using ld = long double; const int N = 55; string s[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) cin >> s[i]; int sx, sy, ex, ey; for (int i = 0; i < n... |
// spw_light_hps_0_hps_io.v
// This file was auto-generated from altera_hps_io_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.1 593
`timescale 1 ps / 1 ps
module spw_light_hps_0_hps_io (
output wire [12:0] mem_a, // memory.mem_a
output wire [2:0] mem_b... |
#include <bits/stdc++.h> const int N = 1000001; using namespace std; vector<int> a[N]; bool st[N], vis1[N]; void f(int u) { st[u] = true; vis1[u] = true; for (int v : a[u]) { if (st[v]) { cout << Draw ; exit(0); } if (!vis1[v]) { f(v); } } s... |
//
// Generated by Bluespec Compiler, version 2011.03.beta1 (build 23381, 2011-03-08)
//
// On Fri May 6 07:43:57 EDT 2011
//
//
// Ports:
// Name I/O size props
// RDY_usr_sw O 1 const
// led O 8 reg
// RDY_led O ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e+9 + 9; const long double EPS = 1e-9; const long double PI = 3.1415926535897932384626433832795; const int N = 1000500; int n, k, ans[N]; int main() { scanf( %d%d , &n, &k); if (k * 3 > n) { printf( -1 ); return 0; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 2 * 1e5 + 10; ll res; ll a[N]; void solve() { ll t, x, y, ex, ey, neast = 0, nnorth = 0, nsouth = 0, nwest = 0; map<char, int> mp; cin >> t >> x >> y >> ex >> ey; ll k = ex - x; ll l = ey - y; string s;... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated ... |
#include <bits/stdc++.h> using namespace std; int n, m; int l[100005], r[100005], q[100005]; struct node { int v, add; }; node t[4 * 100005]; const int MX = (1LL << 31) - 1; void Push(int v, int tl, int tm, int tr) { if (t[v].add != 0) { t[2 * v].add |= t[v].add; t[2 * v].v |= t[v].a... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; const double PI = 3.14159; vector<string> v; long long n, m, k, d, ans[101], c, sum, a[105][105]; set<string> st; string s, b; bool flag; set<string>::iterator it; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL);... |
#include <bits/stdc++.h> using namespace std; int n, rsp, ans, taram; char first; int main() { cin >> n; cin >> first; if (first == U ) { taram = 2; rsp++; } else taram = 1; for (int i = 2; i <= n; i++) { cin >> first; if (rsp * 2 == i - 1) { ans += (fi... |
#include <bits/stdc++.h> using namespace std; const double pi = 3.141592653589793238463; vector<vector<int> > g; int parent[1009]; void dfs(int u, int prev) { parent[u] = prev; for (int v : g[u]) if (v != prev) dfs(v, u); } bool fme[1009], fhim[1009]; int main() { cin.tie(0); cin.s... |
/**
* 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; const long long lim = 100000000000ll; long long qv[61], dis[100010], ma, nw, dep[100010]; int n, Q, ans[61], x, y, v, hd[100010], cnt, q[100010], l, r, maa, la[100010], rt[100010]; struct node { int to, next, val; } e[200010]; struct seg { int ls... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; int main() { int n, m; scanf( %d %d , &n, &m); string S; set<int> H[n]; set<int> V[m]; for (int i = 0; i < (n); i++) { cin >> S; for (int j = 0; j < (m); j++) if (S[j] != . ) { 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... |
// ==============================================================
// 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... |
module test;
logic reset_li, clk, yumi_li;
logic [1:0] req_li, gnt_lo;
bsg_arb_round_robin
#(.width_p(1)) barr2
(.reset_i()
,.clk_i(clk)
,.reqs_i(1'b1)
,.grants_o()
,.yumi_i()
);
bsg_arb_round_robin
#(.width_p(2)) barr
(.reset_i(reset_li)
,.clk_i(clk)
,.reqs_i(req_li)
,.... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e3 + 5; string s, p; int nxt[MAX]; vector<int> cost; int memo[MAX][MAX]; int roll(int idx, int val) { if (idx >= (int)cost.size()) { return 0; } int &ans = memo[idx][val]; if (~ans) { return ans; } ans = rol... |
#include <bits/stdc++.h> using namespace std; int n; vector<char> veq; void getVeq() { string s; cin >> s; veq.clear(); n = s.length(); veq.push_back( x ); veq.push_back( x ); for (int i = 0; i < s.length(); i++) veq.push_back(s[i]); veq.push_back( x ); veq.push_back( x ); ... |
// -*- Mode: Verilog -*-
// Filename : testbench.v
// Description : Wishbone DSP Testbench
// Author : Philip Tracton
// Created On : Wed Dec 2 13:12:45 2015
// Last Modified By: Philip Tracton
// Last Modified On: Wed Dec 2 13:12:45 2015
// Update Count : 0
//... |
// wasca_nios2_gen2_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 193
`timescale 1 ps / 1 ps
module wasca_nios2_gen2_0 (
input wire clk, // cl... |
#include <bits/stdc++.h> using namespace std; int pre[100010]; char f[100010]; int a[100010]; int ans[100010]; int main() { int n, m, i, c, cnt = 0; scanf( %d , &n); scanf( %d , &m); for (i = 0; i < n; ++i) { scanf( %c , &f[i]); scanf( %c , &f[i]); scanf( %d , &a[i]); ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e4 + 10, mod = 1e9 + 7, M = 510; const double PI = 3.1415926535; long long res[40], p[40], ei[40], sum[N], cnt; double pre[N]; int path[100]; void dfs(int u, int s, long long va) { if (u == -1) { sum[s] = ((long long)sum[s] + va) % mod... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read() { register T sum = 0; register char cc = getchar(); int sym = 1; while (cc != - && (cc > 9 || cc < 0 )) cc = getchar(); if (cc == - ) sym = -1, cc = getchar(); sum = sum * 10 + cc - 0 ; cc = getc... |
#include <bits/stdc++.h> const int maxi = 2000000000; const int maxq = 1000000000; const double eps = 1e-10; const double pi = 3.1415926535897932; const double inf = 1e+18; const int mo = 1000000007; using namespace std; int stn, ms[1111][1111], n, k, t, st[1111111], x, y, z, sum; bool f[11111]; voi... |
#include <bits/stdc++.h> using namespace std; namespace Work { const int kMaxN = 100010; multiset<int> set; int n; int a[kMaxN], b[kMaxN]; int pos[kMaxN]; void solve(FILE* fin, FILE* fout) { fscanf(fin, %d , &n); for (int i = 1; i <= n; i++) { fscanf(fin, %d , a + i); pos[a[i]] = i... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2017/07/16 23:45:14
// Design Name:
// Module Name: top_level_sim
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int h = n / 2; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i <= h) { if (j >= h - i && j <= h + i) { cout << D ; } else { cout << * ; ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1010; char mtr[MAXN][MAXN]; int main() { int n, m; cin >> n >> m; set<int> s; bool ok = true; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> mtr[i][j]; } } for (int i = 1; i <= n;... |
#include <bits/stdc++.h> using namespace std; long long int ABS(long long int a) { if (a < 0) return (-a); return a; } void input() {} int main() { long long int n, t; int f = 0; scanf( %llu , &n); scanf( %llu , &t); long long int x[n]; for (int i = (1); i < (n); ++i) { s... |
#include <bits/stdc++.h> using ll = long long; using ld = long double; using namespace std; const int MAXN = 2000228; const ll INF = (1ll << 50); set<pair<ll, ll>> s; void ins(ll x, ll y) {} int main() { ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20); cout.ti... |
#include <bits/stdc++.h> using namespace std; int caseno = 1; typedef long long LL; typedef unsigned long long ULL; template <class T> inline void SWAP(T &a, T &b) { T t = a; a = b; b = t; } inline LL POW(LL base, LL power) { LL res = base; if (power == 0) return 1; for (int I = ... |
#include <bits/stdc++.h> using namespace std; int main() { double n, l, v1, v2, k; cin >> n >> l >> v1 >> v2 >> k; double m = ceil(n / k); double ans = l * v2 / (v1 * v2 - v2 * (v1 * v1 - v2 * v2) / (v1 + (2 * m - 1) * v2)); cout << fixed << setprecision(10) << ans; return 0; } |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 1000000; const int mod = 998244353; bool cmp(int x, int y) { return x > y; } int main() { long long n, ans = 0; cin >> n; if (n == 0) { cout << 0; return 0; } n += 1; if (n % 2 == 0... |
/*
*
* 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 version.
*
* This program is distributed in the ... |
/**
* 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 of simple simulation.
*/
`timescale 1ns / 1ns
module main;
/*
* Signals.
*/
reg clock; /* Clock input of the design */
reg reset; /* Active high, synchronous Reset */
reg enable; /* Active high enable signal for counter */
reg [3:0] count; /* 4... |
#include <bits/stdc++.h> using namespace std; const int N = 200010; const int px[] = {0, 0, 1, -1}, py[] = {1, -1, 0, 0}; int n, m, a[1010][1010], tx[N], ty[N], f[N], ch[N][2], rev[N], tr[N * 4], cnt[N * 4], tag[N * 4]; long long ans; bool isroot(int x) { return !x || !f[x] || (ch[f[x]][0] != x &&... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); int dblcmp(double d) { if (fabs(d) < eps) return 0; return d > eps ? 1 : -1; } long long n, t; int a[66], l, p; long long dp[66][2][66]; long long getdp(int len, int less, int tot) { if (le... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s; cin >> s; int i = 0, j = 0; int freq[2] = {0, 0}; int ans = 0; bool over = 0; while (j < n) { while (min(freq[0], freq[1]) <= k && j < n) { freq[s[j] - a ]++; if (... |
#include <bits/stdc++.h> using namespace std; int main() { int n, xC = 0, XC = 0, i, f = 0; char c; char remain; cin >> n; string o = ; for (i = 0; i < n; i++) { cin >> c; if (c == x ) { xC++; o = o + x ; if (xC == n / 2) { remain = X ; ... |
// =======================================================================
// Filename: alu_test.v
// Created by: Tareque Ahmad
// Date: Feb 20, 2015
//
// Description: Test module for simple_alu dut
// =======================================================================
`timescale 1ns/1ps
`... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.