text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int marked[1000006]; int f(int i, int j) { if (j == 1) { return marked[i]; } return f(marked[i], j - 1); } vector<int> v; int main() { int n, a, b; scanf( %d %d %d , &n, &a, &b); int cut = -1; for (int i = 0; i <= n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int n, m, t; set<pair<int, int> > s; string s1; vector<int> v, v1; int kek[100000]; int main() { cin >> n >> m >> t; for (int i = 1; i <= n; i++) { cin >> s1; int cur = 0; cur += 60 * 60 * 10 * (s1[0] - 0 ); cur += 60 * 60 * (s... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
//////////////////////////////////////////////////////////////////
// Megawizard Generated FIFO
//////////////////////////////////////////////////////////////////
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// V... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2016 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; template <typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const int oo = 0x3f3f3f3f; const int Mod = 1e9 + 7; const int ... |
#include <bits/stdc++.h> using namespace std; struct subject { long long a, b; int c, r, s; bool operator<(subject const &T) const { return c < T.c; } }; int n, m, rex, rey, fx[55][55][105], fy[55][55][105]; long long rat, val, tmp, old, dp[55][55][105], ret; subject a[55]; void trace(int x, i... |
#include <bits/stdc++.h> using namespace std; int II() { int n; scanf( %d , &n); return n; } int table[100][100]; char message[100][200]; string names[100]; void recprint(int m, int s) { if (m < 0) return; recprint(m - 1, table[m][s]); cout << names[s]; printf( :%s n , message[... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e5 + 10; struct Seg { long long mn, id; }; long long arr[maxn], N, P, ans[maxn]; Seg seg[maxn << 2]; inline Seg pushup(long long cur) { Seg l = seg[cur << 1], r = seg[cur << 1 | 1]; if (l.mn == r.mn) { return l; } ... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: gsu_cache.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> using namespace std; int n, m; int cnta[10], cntb[10]; int a[15][2], b[15][2]; int one_common(int x, int y) { if (a[x][0] == b[y][0] && a[x][1] != b[y][1]) return a[x][0]; if (a[x][1] == b[y][0] && a[x][0] != b[y][1]) return a[x][1]; if (a[x][0] == b[y][1] && a[x][1] != b[... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; long long a[2005], b[2005]; vector<pair<long long, pair<int, int> > > bb; long long diff = 0L; bool good(long long x, int place) { if (place >= bb.size()) return false; else return diff + 2 * (bb[place].first - x) <= 0; } int find_(long lon... |
#include <bits/stdc++.h> int main() { int n, v, pre, rotting, a[4005], b[4005], i, j, bag, collect, day, v2; while (scanf( %d%d , &n, &v) != EOF) { day = 0; bag = 0; for (i = 0; i < n; i++) { scanf( %d%d , &a[i], &b[i]); if (a[i] > day) day = a[i]; } rotting = 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... |
// Copyright (c) 2000-2012 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, pub... |
module vfabric_multiport_lsu_streaming_read(clock, resetn, base_address, size,
i_datain_valid, o_datain_stall,
avm_readdata, avm_readdatavalid, avm_waitrequest,
avm_address, avm_read, avm_write,
avm_writeack, avm_writedata, avm_byteenable,
avm_burstcount,
o_... |
module adc08d1020_serial(
output wire sclk, // typical 15MHz, limit 19MHz
output reg sdata,
output reg scs,
input wire [15:0] w_data,
input wire [3:0] w_addr,
input wire commit,
output wire busy,
input wire clk12p5
);
reg [15:0] l_data;
reg [3:0] ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } const int N = 1e3 + 10; const double eps = 1e-5; int n; struct Tarr { long long tarr[N][N]; Tarr() { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; ; scanf( %d , &n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if ((j + i) % 2 == 0) printf( W ); else printf( B ); } printf( n ); } return 0; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////
// File name : SATA_TOP.v
// Note : This is the top module of SATA2 Host Controller
// Test/Verification Environment
// Dependencies : Nil
//////////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200100; vector<pair<int, int> > d[2]; vector<int> S[2]; int n, v; int main() { cin >> n >> v; int sum = 0; for (int i = 0; i < n; i++) { int t, s; cin >> t >> s; sum += s; d[t - 1].push_back(make_pair(s, i + 1... |
// Copyright 2006, 2007 Dennis van Weeren
//
// This file is part of Minimig
//
// Minimig 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 ve... |
#include <bits/stdc++.h> using namespace std; int main() { long long MAX = pow(2, 32) - 1; int n; cin >> n; stack<int> fors; long long val = 0; long long num = 1; int i = 0; while (i != n) { string str; cin >> str; if (str == add ) { val += num; } els... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; template <class A, class B> A cvt(B x) { stringstream ss; ss << x; A y; ss >> y; return y; } typedef struct { string name; int c; int p[3]; int size; int room; } item; typedef struct { string name; int c; int... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2018 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of variou... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; bool valid(int x, int y) { return x >= 0 && y >= 0 && x < 3 && y < 3 ? 1 : 0; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_bb
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: w... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long MAX = 1e6 + 10; long long a[100005]; int main() { long long n, k, m, sum, t, len; string s, d; while (cin >> n) { int flag = 1; sum = 0; if (n % 2 == 0) { cout << n / 2 << endl; ... |
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; long long powmod(long long a, long long l, long long md) { long long res = 1; while (l) { if (l & 1) res = res * a % md; l /= 2; a = a * a % md; } return res; } long long binpow(long long a, long long l) {... |
#include <bits/stdc++.h> using namespace std; long long modI(long long a, long long m); long long gcd(long long a, long long b); long long powM(long long x, long long y, long long m); long long swap(long long a, long long b); void swap(long long& a, long long& b) { long long tp = a; a = b; b = t... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFF = 0x3f3f3f3f3f3f3f3fll; const long long M = 1e9 + 7; const long long maxn = 1e5 + 7; const double eps = 0.00000001; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } template <typename ... |
#include <bits/stdc++.h> using namespace std; bool maxl(long long a, long long b) { return a > b; } bool minl(long long a, long long b) { return a < b; } bool cmp(int a, int b) { return a > b; } inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch ... |
#include <bits/stdc++.h> using namespace std; void print(pair<int, int> v) { if (v.first < 10) { cout << 0 << v.first << : ; } else { cout << v.first << : ; } if (v.second < 10) { cout << 0 << v.second; } else { cout << v.second; } } int main() { int n; ... |
/*
*
* 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 ... |
#include <bits/stdc++.h> using namespace std; class ReverseBit { public: ReverseBit(int size) : bit_(size + 1, 0) {} void Add(int pos, int num); int GetMax(int pos) const; private: static int Lsb(int num) { return num & -num; } vector<int> bit_; }; void ReverseBit::Add(int pos, int ... |
#include <bits/stdc++.h> using namespace std; char x[100100]; long x2[100100]; long mes[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; long wr = 0; long res, cur, repsmax = -1; long reps = 0; long tmp1, tmp2, tmp3; string s1; int compare(const void *a, const void *b) { return (*(long *)a... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long double EPS = 1e-6; const int N = 200020, MOD = 998244353; int n, k; long long a[N + 20], fact[N + 20], inv[N + 20]; long long qpow(long long a, long long b, long long p = MOD) { long long ans = 1; for (; b; b >>= ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int max = a[0]; int pos = 0; for (int i = 0; i < n; i++) { if (max < a[i]) { max = a[i]; pos = i; } } bool k = ... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,avx,avx2 ) const long long maxn = 64, mod = 1e9 + 7, INF = 1e9, lg = 15 + 1, SQRT = 400; int n, a[maxn], par[maxn], SZ_T[maxn], FAC[maxn], INV[maxn]; vector<int> adj1[maxn], adj2[maxn], c... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
`ifdef VCS
`define NO_SHORTREAL
`en... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: ff_24x2048_fwft_async.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// =================================... |
#include <bits/stdc++.h> using namespace std; int a[100100], b[100100]; int n, x; multiset<int> st; multiset<int>::iterator it; int main() { scanf( %d%d , &n, &x); for (int i = 0; i < n; i++) scanf( %d , a + i); for (int i = 0; i < n; i++) { int w; scanf( %d , &w); st.insert(w)... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; set<string> s0; for (int i = 0; i < n; i++) { cin >> s; unordered_set<char> s1; s.erase(remove_if(s.begin(), s.end(), [&](char const c) { return !(s1.insert(c).second);... |
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FORI(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define ll long long #define mp(m, n) make_pair((m), (n)) // #define DEBUG #ifdef DEBUG template<typename T> void _debug(string s, T x... |
#include <bits/stdc++.h> using namespace std; int main(void) { int xa, ya; int xb, yb; int xc, yc; double k, b, y; scanf( %d %d , &xa, &ya); scanf( %d %d , &xb, &yb); scanf( %d %d , &xc, &yc); if (xa != xb) { k = (double)(yb - ya) / (xb - xa); b = ya - (double)(yb - ya) /... |
// -*- verilog -*-
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
module qa_contents
#(
parameter WIDTH = 32,
parameter MWIDTH = 1
)
(
input wire clk,
input wire rst_n,
input wire [WIDTH-1:0] in_data,
input wi... |
// 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
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; const int M = 128; const int inf = 0x7fffffff; const long long INF = 9E18; const int mod = 1e9 + 7; int tree[maxn << 2][2], a[maxn]; int in[maxn], out[maxn], dis[maxn]; int dfs_clock = 0; vector<int> g[maxn]; void dfs(int u, ... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; int n, q, len[N]; char name[N][20], ip[N][20]; bool dy(char ip1[], char ip2[], int len) { for (int i = 0; i < len; i++) if (ip1[i] != ip2[i]) return 0; return 1; } int main() { scanf( %d%d , &n, &q); for (int i = 1; i ... |
#include <bits/stdc++.h> using namespace std; /*<DEBUG>*/ #define tem template <typename #define can_shift(_X_, ...) enable_if_t<sizeof test<_X_>(0) __VA_ARGS__ 8, debug&> operator<<(T i) #define _op debug& operator<< tem C > auto test(C *x) -> decltype(cerr << *x, 0LL); tem C > char test(...); tem ... |
#include <bits/stdc++.h> using namespace std; static struct FastInput { static constexpr int BUF_SIZE = 1 << 20; char buf[BUF_SIZE]; size_t chars_read = 0; size_t buf_pos = 0; FILE* in = stdin; char cur = 0; inline char get_char() { if (buf_pos >= chars_read) { chars_read =... |
#include <bits/stdc++.h> using namespace std; int N, V, k, y; vector<int> vec; int main() { cin >> N >> V; for (int i = 1; i <= N; i++) { cin >> k; int x = 1000000000; for (int j = 1; j <= k; j++) { cin >> y; x = min(x, y); } if (x < V) vec.push_back(i); ... |
#include <bits/stdc++.h> using namespace std; const long long logn = 63; const long long inf = 1e18; void upd(long long& a, const long long& b) { a = min(a, b); } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<long long> a(n), b(n); for (int i = 0; i < n;... |
#include <bits/stdc++.h> using namespace std; const long long INF = 9e18L; const long long mod = 1e9 + 7; long long power(long long x, long long y) { long long res = 1; int mod = 1e9 + 7; while (y > 0) { if (y & 1) (res = res * x) %= mod; (x = x * x) %= mod; y = y >> 1; } r... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:27:23 04/18/2014
// Design Name:
// Module Name: pbdebounce
// 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... |
module MPUC707 ( CLK,ED, DS, MPYJ,DR,DI ,DOR ,DOI );
// MPUC707 #(nb+2) UM707(.CLK(CLK),.ED(ED), .DS(es), .MPYJ(mpyj) ,
parameter total_bits = 32;
input CLK ;
wire CLK ;
input DS ; //data strobe
wire DS ;
input ED; //slowdown
input MPYJ ; //the result is multiplied by -j
wire MPYJ ;
input [to... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > di = {{2, 1}, {1, 2}, {-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}}; int n, m; int X1, Y1, X2, Y2; queue<pair<int, int> > q1, q2; bool isValid(pair<int, int> cell) { return (1 <= cell.firs... |
#include <bits/stdc++.h> using namespace std; map<string, int> nums; int liking[7][7]; bool usable[7]; int team[7]; vector<int> members[3]; int mindifference, maxliking; int a, b, c; void teaming(int currteam, int memberno) { int i, j, t; if (currteam == 2 && memberno == 7) { int exp1 = ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; bool lucky[10010]; int n, m; int a[N]; int t[N + N]; void init() { memset(lucky, false, sizeof(lucky)); lucky[0] = true; for (int i = 1; i <= 10000; i++) if (i % 10 == 4 || i % 10 == 7) lucky[i] = lucky[i / 10]; } ... |
// __ // _______ / _|_ _ _ __ _ _ ___ // |_ / _ |_| | | | __| | | / __| created on // / / __/ _| |_| | | | |_| __ 18 Mar 2021 00:06:00 // /___ ___|_| __, |_| __,_|___/ // |___/ #include<bits/stdc++.h> using na... |
#include <bits/stdc++.h> using namespace std; long long spf[101]; long long fac[101]; void sieve() { spf[1] = 1; for (long long i = 2; i < 101; i++) spf[i] = i; for (long long i = 4; i < 101; i += 2) spf[i] = 2; for (long long i = 3; i * i < 101; i++) { if (spf[i] == i) { for (long... |
#include <bits/stdc++.h> using namespace std; const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1}; const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1}; long long ax, ay, bx, by, cx, cy; long long dist(long long x1, long long y1, long long x2, long long y2) { return ((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)); }... |
#include <bits/stdc++.h> using namespace std; int n, m, nxt[402][26]; string s, t; int dp[401][401]; bool solve2(string t1, string t2) { dp[0][0] = -1; for (int i = 0; i <= t1.size(); ++i) { for (int j = 0; j <= t2.size(); ++j) { if (!i && !j) continue; dp[i][j] = n; if (... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; long long l_occ_1 = -1, l_occ_2 = -1, l_occ_3 = -1; long long maxi = s.length() + 1, mini; for (long long i = 0; i < s.length(); i++) { if (s[i] == 1 ) l_o... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty.
// SPDX-License-Identifier: CC0-1.0
// bug998
interface intf
#(parameter PARAM = 0)
();
logic val;
function integer func (); return 5; endfunction
endinterface
module t1(... |
#include <bits/stdc++.h> using namespace std; const int N = 4e6 + 10; int n, m; int a[N]; int find(int x) { for (int i = 1; i <= n; i++) { if (a[i] == x) return i; } } vector<int> v; signed main() { int x, y, z, T; cin >> T; while (T--) { scanf( %d , &n); for (int i... |
//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... |
/**
* 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> #define mx 100005 #define lli long long int #define ulli unsigned long long int #define mset(a,b) memset(a, b, sizeof(a)) #define infile freopen( in.txt , r , stdin); #defi... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, cnt, Max, head[N]; struct Edge { int to, nxt, val; } e[N << 1]; int read() { int x = 0, flg = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) flg = -1; for (; isdigit(c); c = getchar... |
#include <bits/stdc++.h> using namespace std; int main() { long n, m; while (cin >> n >> m) { long c = 0; if (n * 2 >= m) { for (int i = 0; i < m; i++) { cout << i + 1 << ; } } else { c = 1; for (int i = 2 * n + 1; i <= m; i++) { cout ... |
//Legal Notice: (C)2015 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... |
#include <cstdio> #include <algorithm> #define ll long long int using namespace std; const int MAX = 1e7+10; int t, c; int ans[MAX]; int prime[MAX], pcount; bool vis[MAX]; ll d[MAX], f[MAX]; void eular() { for (int i = 1; i <= MAX; i++) ans[i] = MAX; ans[1] = 1; for (int i = 2; i <... |
#include <bits/stdc++.h> using namespace std; long long a[100005]; int main() { long long n; scanf( %lld , &n); for (long long i = 0; i < n; i++) scanf( %lld , &a[i]); sort(a, a + n); long long sm = 0; for (long long i = 0; i < n / 2; i++) { sm = ((sm % 10007) + ((a[i] % 10007) * (a[... |
#include <bits/stdc++.h> using namespace std; long long t, n; long long qpow(long long a, long long b) { long long x = 1, base = a; while (b) { if (b & 1) { x = (x * base) % 1000000007; } base = (base * base) % 1000000007; b >>= 1; } return x % 1000000007; } int... |
#include <bits/stdc++.h> using namespace std; int n; vector<long long> v(100005); vector<int> cache(1e5 + 10, -1); int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; map<int, int> mp; for (long long i = 0; i < n; i++) { int x; cin >> x; set<int> st; for (in... |
#include <bits/stdc++.h> using namespace std; struct segment { int pos; int len; int type; }; struct lengthComparator { bool operator()(const segment &a, const segment &b) const { if (a.len != b.len) return a.len > b.len; else return a.pos < b.pos; } }; struct... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic Single-Port Synchronous RAM ////
//// ////
//// This file is part of memory li... |
//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... |
#include <bits/stdc++.h> using namespace std; struct no { int x, y, r; }; no A, B, b, a; int dist(no u, no v) { return (u.x - v.x) * (u.x - v.x) + (u.y - v.y) * (u.y - v.y); } bool contido(no v, no u) { if (u.r < v.r) return 0; if ((sqrt(dist(v, u)) + (double)((v.r)) - 1e-2 < (double)(u.r)... |
module recepcion_TB;
reg rx=1;
wire avail;
reg clk_in;
wire clk_div;
reg reset=0;
wire [7:0] dout;
recepcion rec(.rx(rx),.clk_in(clk_in),.reset(reset),.dout(dout),.avail(avail),.clk_div(clk_div));
reg [3:0] bitpos = 0;
reg [3:0] counter = 0;
reg [7:0] data = 8'b10101010;
a... |
`timescale 1ns/1ns
module usb_tx_ack
(input c,
input start,
output [7:0] sie_d,
output sie_dv);
`include "usb_pids.v"
localparam ST_IDLE = 3'd0;
localparam ST_SYNC = 3'd1;
localparam ST_PID = 3'd2;
localparam SW=4, CW=2;
reg [CW+SW-1:0] ctrl;
wire [SW-1:0] state;
wire [SW-1:0] next_state = ctrl[SW+CW-1:CW]... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; int a[33]; string s; int main() { for (int i = 0; i < 26; ++i) scanf( %d , &a[i]); cin >> s; int len = s.length(); vector<long long> v(len + 1); 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 la... |
#include <bits/stdc++.h> using namespace std; int n, k, q; vector<int> style; vector<vector<int> > place; vector<int> base; vector<vector<int> > t; void read() { cin >> n >> k; style.resize(n + 1); place.resize(100001); base.resize(n + 1); t.resize(n * 4 + 4); for (int 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... |
// ==============================================================
// 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 1ns/1ps
modul... |
/* Aligns data before writing.
* Incoming data is aligned to lsb's
*/
module emesh_wralign (/*AUTOARG*/
// Outputs
data_out,
// Inputs
datamode, data_in
);
input [1:0] datamode;
input [63:0] data_in;
output [63:0] data_out;
wire [3:0] data_size;
assign data_size[0]= (d... |
#include <bits/stdc++.h> using namespace std; const int N = 5e4 + 5, inf = 0x3f3f3f3f; int n, front, x, ans = -inf, nxt; vector<int> interact(int _) { printf( ? %d n , _); fflush(stdout); int a, b; scanf( %d%d , &a, &b); return vector<int>({a, b}); } void give(int _) { printf( ! %d n... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e7 + 9, MAXN = 1e6; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; unsigned long long int k, x; cin >> n; while (n--) { cin >> k >> x; cout << x + 9 * (k - 1) << endl; } return 0; } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: dram_sc_3_rep2.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... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**************************************************************
********波特率计数模块
**1:确定发送数据和接收数据的有效范围
**2:进行分频计数(此例中波特率9600bps,时钟50MHz,则分频计数为5207)
**************************************************************/
module Bps_select(
input clk, //系统时钟50MHz
input rst_n, //低电平复位
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.