text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; template <typename T> inline void chkmin(T &x, T y) { if (y < x) x = y; } template <typename T> inline void chkmax(T &x, T y) { if (y > x) x = y; } template <typename T> inline T add(T x, T y) { return (x + y) % 1000000007; } template <type... |
/**
* 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 maxn = 1e3 + 7; int n; int a[maxn], b[maxn]; long long solve() { long long res = 0; for (int i = 0; i < int(n); i++) { long long sa = 0, sb = 0; for (int j = i; j < int(n); j++) { sa |= a[j]; sb |= b[j]; res = ... |
module BoothPPG_32R4(a ,b, sign,
i, pp0, pp1, pp2, pp3,
pp4, pp5, pp6, pp7,
pp8, pp9, pp10, pp11,
pp12, pp13, pp14, pp15,
pp16);
input wire[31:0] a;
input wire[31:0] b;
input wire sign;
output wire[15:0] i;
output wire[33:0] pp0;
output wire[33:0] pp1;
output wire[33:0] pp2;
output wire[33:0] pp3;... |
// modelling dma_sequencer.v together with dma_access.v
`define NO_CPU
module tb;
parameter DEVNUM = 4;
integer i,j,k;
tri1 iorq_n,mreq_n,rd_n,wr_n;
reg clk,rst_n;
tri0 busrq_n,busak_n;
trireg [15:0] zaddr;
tri [7:0] zdata;
wire dma_req,dma_rnw;
wire dma_ack,dma_end;
wire dma_b... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, a[N], lm[N], rm[N], q[N]; vector<int> tree[35]; long long ans; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); for (int j = 0; (1 << j) <= a[i]; j++) if (a[i] & (1 << j)) ... |
#include <bits/stdc++.h> int main() { long long u, v, a, b; scanf( %lld%lld , &u, &v); if (v == 0) printf( 0 n ); else if (u > v) printf( -1 n ); else if (u == v) { printf( 1 n ); printf( %lld n , u); } else if ((v - u) % 2 == 0) { a = u, b = (v - u) / 2; if... |
#include <bits/stdc++.h> using namespace std; const int inf = ~0U >> 1; const long long linf = (long long)1e18; const double eps = 1e-6; template <class T> string tostr(T a) { ostringstream out; out << a; return out.str(); } struct debugger { template <typename T> debugger &operator,... |
//////////////////////////////////////////////////////////////////////
//// ////
//// dbg_comm_vpi.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; void ask(int r1, int c1, int r2, int c2) { cout << ? << r1 << << c1 << << r2 << << c2 << n ; cout.flush(); } bool ans() { string ans; cin >> ans; return ans == YES ; } int main() { ios::sync_wi... |
#include <bits/stdc++.h> using namespace std; long double PI = acos(-1); long double DEL = 1e-10; int M = 1e9 + 7; const int N = 3e5 + 10; #define ftt cin>>tc;for(int cas=1;cas<=tc;++cas) #define all(a) a.begin(),a.end() #define vpii vector<pair<int,int> > #define vvi vector<vector<int> > #defin... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xenia Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 505; int n, m; int v[MAXN]; int head[MAXN]; double e[MAXN * MAXN]; int a, b, c; int main() { while (scanf( %d%d , &n, &m) != EOF) { for (int i = 1; i <= n; i++) scanf( %d , &v[i]); for (int i = 1; i <= m; i++) { scanf... |
//
// Generated by Bluespec Compiler (build 0fccbb13)
//
//
// Ports:
// Name I/O size props
// m_near_mem_io_addr_base O 64 const
// m_near_mem_io_addr_size O 64 const
// m_near_mem_io_addr_lim O 64 const
// m_plic_addr_base O 64 const
// m_plic_... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long a, b; for (a = 0; a <= n / 1234567; a++) { for (b = 0; b * 123456 <= n - a * 1234567; b++) if ((n - (a * 1234567 + b * 123456)) % 1234 == 0) { cout << YES ; return 0; ... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const long long mod = 998244353; const long long maxn = 3e5 + 10; long long p[2] = {1000000007, 998244353}; long long seed[2] = {500000004, 500000004}; int main() { int x, a[6]; scanf( %d , &x); for (int i = 0; i < 6; i++) ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; queue<long long> q1; long long a[20005]; long long l, r; int main(void) { int i = 0; int j; cin >> l >> r; q1.push(0); while (1) { a[i] = q1.front() * 10 + 4; i++; if (a[i - 1] >= r) break; q1.push(a[i - 1]); a[i] ... |
#include <bits/stdc++.h> using namespace std; vector<long long> factors(long long n) { vector<long long> first; long long tem = 1; for (long long x = 2; x * x <= n; x++) { while (n % x == 0) { first.push_back(x); n /= x; } } if (n > 1) first.push_back(n); return f... |
#include <bits/stdc++.h> using namespace std; const int mn = 101000; vector<int> e[mn]; int c[mn], s[mn], sc[mn], sv[mn]; int R[mn], vis[mn]; int n, m, i, j, k, nc, tt; long long ans; bool cmpc(int i, int j) { return c[i] > c[j]; } bool cmps(int i, int j) { return s[i] < s[j]; } void add(int i, int ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; long long a[100005]; long long b[100005]; long long x; long long n, m; long long c[100005]; long long d[100005]; void solve() { cin >> n >> m; for (long long i = 0; i < n; i++) { cin >> a[i]; if (i) a[i] += a[i - 1]; c[i + 1] = 1e9;... |
/*
* @Author: tmh
* @Date: 2017-07-25 20:02:24
* @File Name: PC.v
*/
`include "define.v"
module PC (
input clk , // Clock
input rst_n , // Asynchronous reset active low
input [ 8:0] IR , // Instruction in
input [ ... |
#include <bits/stdc++.h> const int N = 1e5 + 5; const int K = 655; const int mod = 998244353; int T; int n, a[N]; int q[K], v[K], w[K], top = 0; int q2[K], v2[K], w2[K], top2 = 0; int MOD(int x) { return x >= mod ? x - mod : x; } int u(int x, int y) { return (x + y - 1) / y; } int main() { scanf... |
#include <bits/stdc++.h> using namespace std; void solve() {} const long long maxn = 1050; long long n, a, b; long long ans[maxn][maxn]; void no() { cout << NO << n ; exit(0); } signed main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> a >> b; if (min(a, b) > 1) no(); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; const int maxd = 205; struct Node { int l, d; } leg[maxn]; bool operator<(const Node &a, const Node &b) { return a.l > b.l; } int n, tot[maxd], td = 0, md = 0; int Solve(int st, int ed) { int cnt = ed - st; int res = td; ... |
// -----------------------------------------------------------------------------
// -- --
// -- (C) 2016-2022 Revanth Kamaraj (krevanth) --
// -- ... |
#include <bits/stdc++.h> const int MOD = 1000000007; const int Inv2 = 500000004; inline int mul(int x, int y) { return (long long)x * (long long)y % MOD; } inline int add(int x, int y) { int r = x + y; if (r >= MOD) r -= MOD; return r; } inline int qpow(int a, int p) { int x = a, ans = 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, r; cin >> n >> r; double alpha = 90.0 - 180.0 / n; double val = cos(alpha * 3.14159265 / 180.0); double ans = val * (double)r / (1 - val); cout << fixed << setprecision(6) << ans << endl; r... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T& t) { T f = 1; char ch = getchar(); t = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -f; ch = getchar(); } while (ch >= 0 && ch <= 9 ) t = t * 10 + ch - 0 , ch = getchar(); t ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; string s[N]; int n, k, fa[N], len[N], ch[N][26], root = 1, last = 1, tot = 1, times[N]; void insert(int x) { int now = ++tot, pre = last; last = now, len[now] = len[pre] + 1; for (; pre && !ch[pre][x]; pre = fa[pre]) ch[pre][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... |
module ADC_CTRL (
iRST,
iCLK,
iCLK_n,
iGO,
iCH,
oLED,
oDIN,
oCS_n,
oSCLK,
iDOUT
);
input iRST;
input iCLK;
input iCLK_n;
input iGO;
input [2:0] iCH;
output [7:0] oLED;
output oDIN;
output oCS_n;
output oSCL... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; int n, m, k; struct node { int x, y, step; }; char s[maxn][maxn]; bool vis[maxn][maxn][4]; int go[4][2] = {0, 1, 1, 0, 0, -1, -1, 0}; int bfs(int x, int y, int tx, int ty) { for (int i = 0; i < 4; ++i) vis[x][y][i] = 1; ... |
/*
* Copyright (c) 2001 Eric Brombaugh <>
*
* 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)
* ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string l; cin >> l; sort(l.begin(), l.end()); int a = 0, ans = 0; char p = l[0]; for (;;) { if (l[0] == p) { a++; l.erase(l.begin()); } else { ans = max(ans, a); ... |
#include <bits/stdc++.h> using namespace std; const long long M = 998244353; long long modpow(long long base, long long exp, long long modulus = M) { base %= modulus; long long result = 1; while (exp > 0) { if (exp & 1) result = (result * base) % modulus; base = (base * base) % modulus; ... |
#include <bits/stdc++.h> using namespace std; vector<int64_t> v[3001]; int64_t calc(int64_t taken, int64_t n, int64_t m) { int64_t req = taken - v[0].size(); int64_t t = v[0].size(); int64_t ans = 0; vector<int64_t> rem; for (int64_t i = 1; i < m; i++) { if (v[i].size() == 0) continue; ... |
`timescale 1s/1s
module test(outp, outm, outl, in);
output outp, outm, outl;
input in;
// Check a primitive.
assign #1 outp = ~in;
// Check a multiplexer.
assign #1 outm = in ? in : 1'b0;
// Check a LPM.
assign #1 outl = in === 1'b1;
endmodule
// This is not exactly the same as the original code, b... |
`timescale 1ns / 1ps
/////////////////////////////////////////////////////////////////
// Module Name: lab1_tb
/////////////////////////////////////////////////////////////////
module lab1_tb(
);
reg [7:0] switches;
wire [7:0] leds;
reg [7:0] e_led;
integer i;
lab1 ... |
#include <bits/stdc++.h> using namespace std; int a[514]; long long int dp[514][514]; long long int mod = 1000000007ll; long long int mdp(int s, int e) { if (s == e) return 1; if (dp[s][e] != -1) return dp[s][e]; long long int& ans = dp[s][e]; if (s + 1 == e) return ans = 1; ans = mdp(s + ... |
#include <bits/stdc++.h> using namespace std; template <class T> bool umin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> bool umax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } long long a, b, c, type, ric[300007], ... |
#include <bits/stdc++.h> using namespace std; const long long N = 20; long long n, m, dp[N][1 << N], B, res, cb[1 << N]; bool used[N][1 << N], w[N][N]; long long cbit(long long x) { long long c = 0; while (x) { c += x & 1; x /= 2; } return c; } signed main() { ios_base::syn... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n, normg, bekg, uykg, beksur, uyksur; int i, j, x, y, t = 0, A[1000][2], fark; cin >> n >> normg >> bekg >> uykg >> beksur >> uyksur; for (i = 1; i <= n; i++) cin >> A[i][0] >> A[i][1]; for (i = 1; i <= n; i++) { t += abs(A[i][... |
// 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 : Fri Jan 13 17:31:20 2017
// Host : KLight-PC running 64-bit major release (bu... |
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015
// Date : Sun Aug 28 01:02:31 2016
// Host : fpgaserv running 64-bit Ubuntu 14.04.4 LTS
... |
/**
* 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 opc5lscpu( input[15:0] din, input clk, input reset_b, input int_b, input clken, output vpa, output vda, output[15:0] dout, output[15:0] address, output rnw);
parameter MOV=4'h0,AND=4'h1,OR=4'h2,XOR=4'h3,ADD=4'h4,ADC=4'h5,STO=4'h6,LD=4'h7,ROR=4'h8,NOT=4'h9,SUB=4'hA,SBC=4'hB,CMP=4'hC,CMPC=4'hD,BSWP=4'hE,PSR=4'... |
/*
* Copyright 2010, Aleksander Osman, . 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 MAXN = 1e5 + 10, Mod = 1e9 + 7; long long fact[2 * MAXN], dp[MAXN], ps[MAXN], inv[MAXN * 2]; pair<long long, long long> a[MAXN]; long long power(long long x, long long y) { if (!y) return 1; long long ans = power(x, y / 2); ans *= ans; 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 la... |
// Benchmark "adder32" written by ABC on Wed Jan 7 18:50:17 2015
module adder32 (
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15,
b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15,
s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15,
cout );
... |
#include <bits/stdc++.h> using namespace std; long long K[5], T[5]; int main() { queue<pair<long long, long long> > Q[5][2]; string ln; int n; getline(cin, ln); istringstream(ln) >> K[1] >> K[2] >> K[3]; getline(cin, ln); istringstream(ln) >> T[1] >> T[2] >> T[3]; getline(cin, ln);... |
/**
* 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; cin >> n; long long data[n + 1]; long long mx = LLONG_MIN; for (int i = 1; i <= n; i++) { cin >> data[i]; mx = max(mx, data[i]); } vector<int> graph[n + 1]; for (int i = 0; i < n - 1; i++) { int s, t;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x[101] = {0}, i, a, m = 0; cin >> n; for (i = 0; i < n; i++) { cin >> a; x[a]++; } for (i = 0; i <= 100; i++) { if (x[i] > m) m = x[i]; } cout << m; } |
/**
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Wed May 31 20:12:37 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; vector<bool> pref(1 << n); for (int i = 0; i < k; i++) { int x; cin >> x; pref[x - 1] = true; } const int oo = -1; vect... |
/**
* 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 big = 1e9; int dp[83][83][83][83], d[100][100]; int s[100][100][100], s1[100][100][100]; int n, kt, m, u, v, c; int main() { cin >> n >> kt >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) d[i][j] = -1; for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; inline int read(); const int M = 200016, MOD = 1000000007; int sz; int ch[M][26], len[M], link[M], pre[M]; void extend(const char *s) { for (int i = 0, lst = 0; s[i]; ++i) { int c = s[i] - a , cur = ++sz; len[cur] = len[l... |
#include<bits/stdc++.h> using namespace std; const int Maxn=2021; const int Mod=998244353; int C[Maxn<<1|5][Maxn<<1|5]; int w[Maxn+5][Maxn+5]; int sum[Maxn+5][Maxn+5]; int ans; void init(){ C[0][0]=1; for(int i=1;i<=(Maxn<<1);i++){ C[i][0]=C[i][i]=1; for(int j=1;j<i;j++){ C[i][j]=(C[i... |
#include <bits/stdc++.h> int main() { int n, i, z = 0, o = 0; char str[120]; scanf( %d , &n); getchar(); gets(str); for (i = 0; i < n; i++) { if (str[i] == 0 ) { z++; } else { o++; } } if (o > 0) { printf( 1 ); } for (i = 0; i < z; i++) ... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; map<int, vector<int> > vec; for (int i = 0; i < a; i++) { int g; cin >> g; vec[g % c].push_back(g); } for (int i = 0; i < c; i++) { if (vec[i].size() >= b) { cout << Y... |
#include <bits/stdc++.h> using namespace std; int main() { int a[200], n, i, s = 0; scanf( %d , &n); for (i = 0; i < 2 * n - 1; i++) { scanf( %d , &a[i]); if (a[i] < 0) s -= a[i]; else s += a[i]; } if (n % 2 == 0) { sort(a, a + 2 * n - 1); for (i = 0... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: xilinx
// Engineer: Yun Rock Qu
//
// Create Date: 12/19/2017 10:33:58 AM
// Design Name: color_swap
// Module Name: color_swap
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
/... |
#include <bits/stdc++.h> using namespace std; int n, k; int d[188]; int par[188]; vector<int> g[188]; int dp[188][188]; int pos[188]; int ans[188]; void build(int x, int pre) { par[x] = pre; for (int i = (0); i < (g[x].size()); ++i) { int to = g[x][i]; if (to == pre) { g[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... |
/*
* Internal RAM for VGA
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; 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 ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n; scanf( %d , &n); int a[n], b[n]; for (int i = 0; i < n; i++) scanf( %d%d , &a[i], &b[i]); if (a[0] < b[0]) printf( NO n ); else { int f = 1; ... |
#include <bits/stdc++.h> using namespace std; int n; int query(int x1, int y1, int x2, int y2) { if (x1 > x2 || y1 > y2) return 0; printf( ? %d %d %d %d n , x1, y1, x2, y2); fflush(stdout); int ans; scanf( %d , &ans); return ans; } int get_right(int x1, int y1, int x2, int y2) { in... |
//*****************************************************************************
// (c) Copyright 2008 - 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 property
/... |
#include <bits/stdc++.h> using namespace std; int main() { int k, a, b; cin >> k >> a >> b; if (a / k + b / k && a % k <= (b / k) * (k - 1) && b % k <= (a / k) * (k - 1)) cout << a / k + b / k << n ; else cout << -1 n ; return 0; } |
#include <bits/stdc++.h> using namespace std; int n, dp[300005], k = 0, b[300005]; vector<int> ke[300005]; void dfs(int u, int par) { if (ke[u].size() == 1 && u != 1) { dp[u] = 1; k++; return; } if (b[u]) dp[u] = 1e9; else dp[u] = 0; for (int v : ke[u]) if... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:57:24 11/17/2016
// Design Name:
// Module Name: DLAU
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenci... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's DC TAG RAMs ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int a[N], c[N]; int ans[N]; struct qq { int x, y, id; } s[N]; int n, Q; bool cmp(qq x, qq y) { return x.y < y.y; } int q[N]; int st, ed, now; double Y(int x) { return a[x] * x - c[x]; } double X(int x) { return -a[x]; } do... |
#include <bits/stdc++.h> using namespace std; int st(int x, int pos) { return x = x | (1 << pos); } int Reset(int x, int pos) { return x = x & ~(1 << pos); } int main() { long long x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (x1 == x2) { cout << 4 + 2 * (abs(y1 - y2) + 1) << endl; } el... |
#include <bits/stdc++.h> using namespace std; struct ppp { int x, y, id; } a[120000], b[120000]; int i, j, k, l, n, m, p, t; bool cmp(const ppp& a, const ppp& b) { return a.y < b.y || a.y == b.y && a.x > b.x; } bool cmp2(const ppp& a, const ppp& b) { return a.x > b.x || a.x == b.x && a.y > b.y... |
module edma (/*AUTOARG*/
// Outputs
mi_dout, edma_access, edma_packet,
// Inputs
reset, clk, mi_en, mi_we, mi_addr, mi_din, edma_wait
);
/******************************/
/*Compile Time Parameters */
/******************************/
parameter RFAW = 6;
parameter AW ... |
#include <bits/stdc++.h> using namespace std; long long int n, m, k, w; vector<vector<vector<char>>> mp; struct dsu { vector<long long int> p, sz; dsu(long long int n) { p.resize(n); sz.resize(n, 1); for (long long int i = 0; i < n; i++) p[i] = i; } long long int getRoot(long l... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long n, ans = 0, a[30], cur, deg = 20, countOfPair = 1; cin >> n; memset(a, 0, sizeof(unsigned long long) * 30); for (int i = 0; i < n; ++i) { cin >> cur; ++a[cur + 10]; } for (int i = 0; i < 10; ++i) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[n]; int c[101] = {0}; for (int i = 0; i < n; i++) cin >> a[i]; long long int sum = a[0]; int b[n]; b[0] = 0; c[a[0]]++; for (int i = 1; i < n; i++) { sum = sum + a[i]; long l... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:45:05 04/18/2015
// Design Name: rgb2ycbcr
// Module Name: /home/vka/Programming/VHDL/workspace/sysrek/skin_color_segm/tb_rgb2ycbcr.v
// Project Name: vision
// T... |
#include <bits/stdc++.h> using namespace std; char chess[8][8]; int main() { for (int i = 0; i < 8; i++) scanf( %s , chess[i]); for (int i = 0; i < 8; i++) { for (int j = 0; j < 7; j++) { if (chess[i][j] == chess[i][j + 1]) { printf( NO n ); return 0; } } ... |
`timescale 1ns / 1ps
/*
* Simple Brainfuck CPU in Verilog.
* Copyright (C) 2011 Sergey Gridasov <>
*
* 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
*... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:21:14 08/24/2011
// Design Name:
// Module Name: q15_mult
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
// ******************************************************************************* //
// ** General Information ** //
// ******************************************************************************* //
// ** Module : iReg.v ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; long long int a[n][2]; for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1]; long long int l[n][2], r[n][2]; long long int mi = a[0][0]; ... |
// Copyright 2021 The CFU-Playground 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 ... |
#include <bits/stdc++.h> using namespace std; long long powmod(long long n, long long q) { long long ans = 1; n %= 1000000007; while (q > 0) { if (q & 1) ans = (ans * n) % 1000000007; n = (n * n) % 1000000007; q >>= 1; } return ans % 1000000007; } int main() { ios_base:... |
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 9; vector<pair<int, int> > barr[N]; int n, q, arr[N], a, b; long long t[N], ans[N]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> arr[i]; scanf( %d , &q); int kok = sqrt(n); for (int i = 1; i <= q; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const long long linf = 1LL << 60; const int maxn = 100 + 5; int A[maxn]; bool used[maxn]; vector<int> Q; vector<vector<int> > B; vector<int> C; int n, k, m, q; long double anal() { long double res = 0; for (int i = 0; i... |
//-----------------------------------------------------
// Design Name : hw1_B_testbench_A_testcase
// File Name : hw1_B_testbench_A_testcase.v
// Function : This program will test hw1_B.v
// Coder : hydai
//-----------------------------------------------------
`timescale 1 ns/1 ns
`include "hw1_B.v"
module hw1_B_te... |
#include <bits/stdc++.h> using namespace std; inline int Get() { int res = 0, q = 1; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) q = -1, ch = getchar(); while (ch >= 0 && ch <= 9 ) res = res * 10 + ch - 0 , ch = getchar(); return res * ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.