text
stringlengths
59
71.4k
// file: clk_gen_83M_exdes.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer i...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_82x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ===============================...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, turn; cin >> n >> k; turn = n / k; if (turn % 2) cout << YES << endl; else cout << NO << endl; return 0; }
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Sun Jun 18 18:22:31 2017 // Host : DESKTOP-GKPSR1F running 64-bit major re...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long ans = 0; for (int i = (0); i < (n); ++i) { long long t, T, x, cost; cin >> t >> T >> x >> cost; if (t >= T) { ans += cost + m * x; continue; } long long aux1 = ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; long long N, S; long long fa[maxn], q[maxn], d[maxn], head, tail, sz[maxn], son[maxn]; bool check(long long Mid) { long long tN = N, now = 1, p = 1, res = 0; while (tN) { res += min(p, tN) * now; if (res > S) return fa...
/** * 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: 2013.4 // Copyright (C) 2013 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
// 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 : Sat Sep 23 13:25:26 2017 // Host : DarkCube running 64-bit major release ...
`timescale 1ns / 1ps module mem_stage ( input clk, input rst, input mem_read, input mem_write, input [31:0] alu_result, input [31:0] B, ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 59; struct State { char c[MAX_N][MAX_N]; }; int H, W; vector<pair<int, int>> solve(State S) { vector<pair<int, int>> D; for (int t = 1; t <= 100000; t++) { bool flag = false; if (H % 2 == 0) { for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; long long n, k, l, r, mid, ans; long long a[200100]; bool check(long long x) { long long p, q; double sum = 0, s; for (long long i = 1; i <= n; i++) { if (a[i] == 0) continue; s = a[i]; if (a[i] >= k) return 1; p = x - 1; q ...
#include <bits/stdc++.h> using namespace std; int main() { int a[] = {0, 1, 2, 3, 4}; int lst[5][5]; for (int i = 0; i < 5; i++) for (int j = 0; j < 5; j++) scanf( %d , &lst[i][j]); int ANS = 0; do { int sum = lst[a[0]][a[1]] + lst[a[1]][a[0]] + lst[a[1]][a[2]] + lst[...
// 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 : Mon Feb 27 15:46:53 2017 // Host : GILAMONSTER running 64-bit major release (...
// *************************************************************************** // *************************************************************************** // 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; template <class T> inline void smax(T &x, T y) { x = max((x), (y)); } template <class T> inline void smin(T &x, T y) { x = min((x), (y)); } inline void scanInt(int &x) { register char c = getchar(); x = 0; bool neg = false; while (c <...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { string ch; cin >> ch; long long int ans = 0; int x = 0, y = 0; set<pair<pair<int, int>, pair<int, int>>> s; pair<int, int> prev = {0, 0}; for (int i = 0; i < (int...
#include <bits/stdc++.h> using namespace std; char g[8][8]; int calc(int x, int y, int a, int d) { int res = 0; while (x != d) { x += a; ++res; if (g[x][y] != . ) return 2e9; } return res; } int main() { for (int i = 0; i < 8; ++i) scanf( %s , g[i]); int a = 2e9, b =...
#include <bits/stdc++.h> using namespace std; int n, k; int haha[105]; int ans = 0; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , &haha[i]); if (haha[i] == 0) break; else if (i < k) ans++; else if (haha[i] == haha[k - 1]) ...
#include <bits/stdc++.h> using namespace std; int n; struct node { long long x, y; } s, t, dist[100005]; int dx[4] = {0, 0, -1, 1}; int dy[4] = {1, -1, 0, 0}; char wind[100005]; string mov = UDLR ; long long pos, l, r, mid; bool check(long long mid) { long long zq = mid / n, sy = mid % n; ...
#include <bits/stdc++.h> using namespace std; long long a, b; map<long long, bool> mp; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for (long long i = 1; i <= 1000; i++) mp[i * i] = 1; cin >> a >> b; for (long long i = -1; i > -a; i--) { if (mp[a * a - i * i]...
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b; cin >> a >> b; if ((a + b) % 3 != 0) { cout << NO << endl; return; } long long mi = min(a, b); long long mx = max(a, b); long long d = mx - mi; if (mx > 2 * mi) { cout << NO << endl; ...
// fpgaTop_ml555.v - ssiegel 2009-03-17 module fpgaTop( input wire sys0_clkp, // sys0 Clock + input wire sys0_clkn, // sys0 Clock - input wire pci0_clkp, // PCIe Clock + input wire pci0_clkn, // PCIe Clock - input wire pci0_rstn, // PCIe Reset out...
/* * 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> int n, a[500005], L[500005], f[500005][22], g[500005][22]; long long ans; int get(int x, int y) { if (x < 0) return 0; int k = (int)log2(y - x + 1); return L[f[x][k]] <= L[f[y + 1 - (1 << k)][k]] ? f[x][k] : f[y + 1 - (1 << k)...
#include <bits/stdc++.h> using namespace std; const int N = 5005; int n, m, ans[N]; pair<int, int> p[N]; vector<pair<int, int> > g[N]; void dfs(int v, int pr = -1) { for (auto it : g[v]) { int to = it.first; if (to != pr) { p[to] = make_pair(v, it.second); dfs(to, v); }...
#include <bits/stdc++.h> class point2D { public: long long x, y; point2D() {} point2D(long long x, long long y) : x(x), y(y) {} bool operator<(const point2D &other) const { return ((y == other.y) ? (x > other.x) : (y > other.y)); } }; point2D operator-(const point2D &u, const point2D ...
// ==================================================================== // Radio-86RK FPGA REPLICA // // Copyright (C) 2011 Dmitry Tselikov // // This core is distributed under modified BSD license. // For complete licensing information see LICENSE.TXT. // ------------------------------------...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int maxn = 2e6 + 5; int n, m, k; int last[30], dp[maxn]; char s[maxn]; int main() { scanf( %d%d%s , &n, &k, s + 1); m = strlen(s + 1); n += m; memset(last, -1, sizeof(last)); dp[0] = 1; for (int i = (1); i...
// // TV80 8-Bit Microprocessor Core // Based on the VHDL T80 core by Daniel Wallner () // // Copyright (c) 2004 Guy Hutchison () // // 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 witho...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2020 Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t(/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [1:0] reg_i; reg ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:15:37 04/08/2015 // Design Name: inst_decoder // Module Name: S:/Xilinx/finalproject/inst_decoder_tb.v // Project Name: finalproject // Target Device: // Tool ve...
#include <bits/stdc++.h> using namespace std; bool ispos(long long x, long long y, long long n, long long m) { if (x < 0 or x >= n or y < 0 or y >= m) return false; else return true; } signed solve() { long long n, m; cin >> n >> m; string s[n]; for (long long i = 0; i < n; i...
#include <bits/stdc++.h> const unsigned long long maxn = 70; unsigned long long n, flg, KKK, ans; unsigned long long f[maxn], mul10[maxn], cycle[maxn], a[maxn]; struct matrix { unsigned long long len, wid; unsigned long long mt[3][3]; } pre[14][45]; inline unsigned long long min(unsigned long long a...
// Copyright (C) 2013 Simon Que // // This file is part of DuinoCube. // // DuinoCube is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; vector<long long> v; unordered_map<long long, long long> m; long long falla(long long n) { if (m.count(n)) { ...
`timescale 1ns / 1ps module registers_test; // Inputs reg clk; reg rst; reg [4:0] readAddr1_i; reg readEnable1_i; reg [4:0] readAddr2_i; reg readEnable2_i; reg [4:0] writeAddr_i; reg [31:0] writeData_i; reg writeEnable_i; // Outputs wire [31:0] data1_o; wire [31:0] data2_o; // Instantiate the Unit Und...
//======================================================================= // Created by : // Filename :pc.v // Author :(RDC) // Created On :2014-05-08 08:49 // Last Modified : // Update Count :2014-05-08 08:49 // Description : // // ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6; const int inf = 1e9 + 100; int a[N + 100], b[N + 100]; vector<pair<int, int> > mon[N + 100]; int tree[N * 4 + 100], lazy[N * 4 + 100]; void build(int v, int tl, int tr) { if (tl == tr) { tree[v] = -b[tl + 1]; return; } ...
// (c) Copyright 1995-2017 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 license and does not grant ...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.1415926535897932384626433832795; template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename T> ostream& operator...
#include <bits/stdc++.h> bool comp(const int& a, const int& b) { return a < b ? false : true; } using namespace std; int main() { long long int k, a, b, m, n; cin >> k >> m >> n; a = max(m, n); b = min(m, n); long long int ans = 0; if (a > 0 && b > 0) { ans = a / k - (b - 1) / k; ...
#include <bits/stdc++.h> int main() { long q; scanf( %ld , &q); while (q--) { long n; scanf( %ld , &n); long div = n / 4; if (n <= 3 || n == 5 || n == 7 || n == 11) { puts( -1 ); continue; } if (n & 1) { --div; } printf( %ld n , div);...
#include <bits/stdc++.h> using namespace std; namespace io { const int l = 1 << 19; char buf[l], *s, *t, c; char gc() { if (s == t) { t = (s = buf) + fread(buf, 1, l, stdin); return s == t ? EOF : *s++; } return *s++; } template <class I> void gi(I &x) { x = 0; c = gc(); ...
#include <bits/stdc++.h> using namespace std; struct node { int x, y; bool operator<(const node& a) const { return x < a.x || x == a.x && y < a.y; } }; const int dr[] = {-1, 1, 0, 0, -1, -1, 1, 1}; const int dc[] = {0, 0, -1, 1, -1, 1, -1, 1}; int HH[277]; char s[401000]; int main() { int n,...
#include <bits/stdc++.h> const int MaxN = 1 << 20; using namespace std; int dp[MaxN + 5]; char s[30][30]; int a[30][30], cost[30][30]; int bit[30][30]; int n, m; int main() { while (~scanf( %d%d , &n, &m)) { for (int i = 0; i < n; i++) scanf( %s , s[i]); for (int i = 0; i < n; i++) ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2017 by John Stevenson. // SPDX-License-Identifier: CC0-1.0 package pkg; typedef logic [31:0] unique_id_t; typedef struct packed { unique_id_t foo; } inner_thing_t; ...
#include <bits/stdc++.h> using namespace std; int used[111111]; multiset<int> g[111111]; multiset<int> vertex; vector<int> ans; void dfs(int v) { used[v] = 1; vertex.erase(v); ans.push_back(v); for (auto i = g[v].begin(); i != g[v].end(); ++i) if (!used[*i]) vertex.insert(*i); if (...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2008 by Lane Brooks. // SPDX-License-Identifier: CC0-1.0 module top (input SEL, input[1:0] A, output W, output X, output Y, output Z); mux mux2 (.A(A), .SEL(SEL), .Z(W)); pass...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, cnt = 1, point = 0; vector<int> x; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; if (b == 0) x.push_back(a); else { cnt += (b - 1); point += a; } } sort(x.begin(),...
/* * 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() { long long n; cin >> n; long long s[n]; for (long long c = 0; c < n; c++) cin >> s[c]; long long sum = 0; long long nextAllowedNum = 10000000000000 + 33; for (long long c = n - 1; c >= 0; c--) { if (nextAllowedNum <= 0) brea...
#include <bits/stdc++.h> using namespace std; enum { UP, DOWN, LEFT, RIGHT }; const int MaxN = 1005; const int MaxM = MaxN * MaxN; const int oo = 0x3F3F3F3F; char mp[MaxN][MaxN]; int dir[MaxM][4]; int d[MaxM][4]; int id[MaxN][MaxN], K; int R, C, s, t; struct Node { int u, dir, d; Node() {}...
#include <bits/stdc++.h> using namespace std; int n; long long ar[100100]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> ar[i]; } sort(ar, ar + n); long long dif1 = ar[1] - ar[0], dif2 = -1; int cnt1 = 0, cnt2 = 0; if (n == 1) { cout << -1 << endl; ret...
#include <bits/stdc++.h> using namespace std; int a[122], b[122]; int main() { int n, k, t, ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> k >> t; a[k]++; b[t]++; } for (int i = 1; i <= 100; i++) if (a[i] > 0) ans += a[i] * b[i]; cout << ans << endl; }
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.1 (win64) Build 881834 Fri Apr 4 14:12:35 MDT 2014 //Date : Fri Apr 10 21:05:15 2015 //Host : LIGHTNING running 64-bit major release (b...
// DESCRIPTION: Verilator: System Verilog test of array querying functions. // // This code instantiates a module that calls the various array querying // functions. // // This file ONLY is placed into the Public Domain, for any use, without // warranty. // SPDX-License-Identifier: CC0-1.0 // Contributed 2012 by Jerem...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool cmax(T &x, T y) { return x < y ? x = y, 1 : 0; } template <typename T> inline bool cmin(T &x, T y) { return y < x ? x = y, 1 : 0; } const int _ = 2e5 + 55, __ = 5e5 + 55; int N; long long a[_], b[_]; char ans[_...
//`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:26:25 12/09/2014 // Design Name: cpu // Module Name: /home/administrator/Documents/Xilinx/RiscCpu/test_cpu.v // Project Name: RiscCpu // Target Device: // Too...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE revB.2 compliant I2C Master controller Top-level //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t, n, m, a, b, c, q, k, d, x; cin >> n >> m; vector<vector<int>> mat(n + 1, vector<int>(m + 1)), ans(n + 1, vector<int>(m + 1)); char ch; ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ff_jbi_sc3_2.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/...
#include <bits/stdc++.h> using namespace std; const int MAXN = 600; int mat[2000][2000]; int quad[20][20]; int cont[20][20]; int main() { int n, m; scanf( %d%d , &n, &m); int foi = 0; int result = -1; for (int i = 0; i < m; i++) { int x, y; for (int h = 0; h < 5; h++) { ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native ) using namespace std; template <typename Tp> inline void read(Tp &x) { static char c; static bool neg; x = 0, ...
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) #pragma comment(linker, /STACK:336777216 ) const int sqrtn = 300; const int inf = 987654321; const int sz = 1e5 + 5; const int mod = 1e9 + 7; int n, vis[sz]; string str; int main() { scanf( %d , &n); cin >> str; ...
/* * 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 N = 2e5 + 30, Mod = 1e9 + 7; const long long SQ = 330; int main() { ios::sync_with_stdio(0), cin.tie(0); long long a, b; cin >> a >> b; long long ans = 0; while (a > 0 && b > 0) { if (a <= b) a++, b -= 2; else ...
#include <bits/stdc++.h> using namespace std; long long n, m, a, b, res; int main() { cin >> n >> m; for (a = 0; a <= 1000; a++) { for (b = 0; b <= 1000; b++) { if (a * a + b == n && a + b * b == m) { res++; } } } cout << res; }
module mandlebrot_factory( input clk, input [ADDR_WIDTH - 1 : 0]raddr, output [DATA_WIDTH - 1 : 0] q ); // Plot between // (-2, 2)Re, (1,-1)Im parameter DATA_WIDTH = 8; parameter ADDR_WIDTH = 9; // parameter PIPE_WIDTH = 2 * DATA_WIDTH + 5; // parameter PIPE_WIDTH = 2 * DATA_WIDTH...
//############################################################################# //# Function: Dual data rate input buffer (2 cycle delay) # //############################################################################# //# Author: Andreas Olofsson # ...
#include <bits/stdc++.h> using namespace std; long long n, m; long long ar[1000001], dp[1001][1001]; long long calc(long long idx, long long rem) { if (rem == 0 && idx != 0) return 1; if (idx >= n) return 0; long long &b = dp[idx][rem]; if (b != -1) return b; else b = 0; b |=...
#include <bits/stdc++.h> using namespace std; int t, n, m, ans; vector<vector<int>> gh, used; int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1}; int dy[8] = {1, 0, -1, 1, -1, 1, 0, -1}; bool onseg(double x1, double y1, double x2, double y2, double x, double y) { double d1 = sqrt((x - x1) * (x - x1) + (y - y1) * (...
/** * 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 long long MOD = 1000000007; const long long INF = 1000000000; template <class T> T read(T &x) { char c; int flag = 1; while ((c = getchar()) < 0 || c > 9 ) if (c == - ) flag *= -1; x = c - 0 ; while ((c = getchar()) >= 0 && c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int ts; cin >> ts; while (ts--) { long long n, i, vis[500] = {0}, a; cin >> n; for (i = 1; i <= 2 * n; i++) { cin >> a; if (vis[a] == ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int nums[n]; for (int i = 0; i < n; i++) { cin >> nums[i]; } if ((nums[0] % 2 == 0)) { cout << No ; return 0; } if ((nums[n - 1] % 2 == 0)) { cout << No ; return 0; } i...
#include <bits/stdc++.h> using namespace std; struct fastIO { fastIO() { ios_base::sync_with_stdio(0); } }; const int MAXN = 1e6 * 2; long long n, a[MAXN], x, ans = MAXN, b; int main() { fastIO(); cin >> n; for (long long i = 0; i < n; i++) cin >> a[i]; for (x = 0; x < n; x++) { b ...
#include <bits/stdc++.h> using namespace std; int mod = 1000000007; int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); } int prime(long long int n) { long long int i; for (i = 2; i <= sqrt(n); i++) { if (n % i == 0) return 0; } return 1; } lo...
/** * 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 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
#include <bits/stdc++.h> using namespace std; struct ww { long long x, y; } c[400][400]; int i, j, k, n, m, ma, ren, C, kuai; int cov[400], zhi[400]; long long b[400][400], s[400][400]; vector<int> a[100010]; inline void gao(int x) { int i, n = kuai - 1, g[400], r = 0; long long jum[400]; ...
// Atari XL/XE SD cartridge // Copyright (C) 2013 Piotr Wiszowaty // // 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)...
#include <bits/stdc++.h> using namespace std; struct road { int x, next; double dis; } r[305 * 305 * 2]; int N, M; int st[305], w; int vis[305]; double P[305]; double l1 = -1, r1 = 0, mid; double dis[305]; void add(int x, int y, double dis) { r[++w].x = y, r[w].next = st[x]; r[w].dis...
/** * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: pcx_buf_p0.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/or...
/** * 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 long double pi = acos(-1); const long long int mod = 1000000007; const double epsilon = 1e-9; template <class T> ostream &operator<<(ostream &out, vector<T> &A) { for (auto x : A) out << x << ; return out; } template <class T> ostream &ope...
/* * 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> int g[102][102]; int main() { int n, t, sum = 0; scanf( %d , &n); t = n / 2; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) scanf( %d , &g[i][j]); for (int i = 0; i < n; ++i) sum += g[i][i] + g[i][n - i - 1] + g[t][i] + g[i][t]; sum -= 3 * g[t][t...
#include <bits/stdc++.h> using namespace std; int n, a[300010], s[300010], x[2]; long long p; int main() { int i, j; long long k; scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %lld , &k); for (j = 0; j <= 60; j++) if (k & (1ll << j)) a[i]++; s[i] = s[i - 1] + a[i];...
#include <bits/stdc++.h> int main() { const double eps = 1e-6; double x[3], y[3]; for (int i = 0; i < 3; ++i) scanf( %lf%lf , &x[i], &y[i]); x[1] -= x[0]; x[2] -= x[0]; y[1] -= y[0]; y[2] -= y[0]; x[0] = y[0] = 0; double cx = (y[2] * (x[1] * x[1] + y[1] * y[1]) - y...
#include <bits/stdc++.h> using namespace std; int n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c; cin >> a >> b >> c; if (b >= a && c >= a) cout << YES n ; else cout << NO n ; return 0; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Case Western Reserve University // Engineer: Matt McConnell // // Create Date: 00:48:00 01/25/2017 // Project Name: EECS301 Digital Design // Design Name: Lab #3 Project // Module Name: ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, g; cin >> n >> g; vector<long long> v, ans; map<long long, long long> m; map<long long, long long>::iterator it; for (int i = 0; i < n; i++) { long long a; cin >> a; m[a]++; } for (it = m.begin(...
/* * 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...
module EX_MEM( input Clk, input stall, input flush, input [31:0]Branch_addr_EX, input [5:0]op_EX, input [2:0]Condition_EX, input Branch_EX, input MemWrite_EX, input RegWrite_EX, input MemRead_EX, input [31:0]MemData_EX, input [31:0]WBData_EX, input Less_EX, input Zero_EX, input Overflow_EX, input [4:0]Rd_EX, output reg...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long ans = 0; for (int i = (0); i < (n); ++i) { long long t, T, x, cost; cin >> t >> T >> x >> cost; if (t >= T) { ans += cost + m * x; continue; } long long aux1 = ...
// 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 module some_module ( input [3:0] i_clks ); logic [ 1 : 0 ] some_state; logic [1:0] some_other_state; logic the_clk; ...
#include <bits/stdc++.h> using namespace std; long long n, k, a, b, ans; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k >> a >> b; if (k == 1) { cout << (n - 1) * a; return 0; } while (n > 1) { if (n % k != 0 && n < k) { ans += (n - 1) * a; ...