text stringlengths 59 71.4k |
|---|
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) int mod = 1000000007; using namespace std; bool isp(long long x) { for (long long i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; } void pog() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; } bool... |
/*
* 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 node { node *arr[27]; int ind; node() { memset(arr, 0, sizeof arr); ind = 0; } }; const int N = 1e5 + 5; int dp[N][2]; node *root; int nodes = 0; void insert(string &s) { node *cur = root; for (int i = 0; i < s.size... |
#include <bits/stdc++.h> using namespace std; int lss[2000][2000] = {}; int main() { string s; cin >> s; int n = s.length(); if (n == 1) { cout << 0 << endl; return 0; } for (int i = 0; i < n; i++) { lss[i][i] = 1; int temp = s[i]; int zero = 0; if (s[i]... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, fl = 0, a[200005], c[200005] = {0}, ans, i, j; cin >> n >> m; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (i = 0; i < n; i++) { a[i] = a[i] % m; c[a[i]]++; if (c[a[i]] > 1) fl ... |
/**
* 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) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module fifo_32_to_8 #(
parameter DEPT... |
#include <bits/stdc++.h> using namespace std; constexpr long long INF = (sizeof(long long) == 4 ? 1e9 : 2e18) + 1e5; constexpr long long MOD = 1e9 + 7; constexpr long long MAXN = 2e5 + 3; void solve() { long long n; cin >> n; string s; cin >> s; long long w = 0; queue<long long> arr; ... |
/**
* 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 associate... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while (tt--) { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int d = unique(a.begin(), a.en... |
#include <bits/stdc++.h> const int a[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 8... |
// (C) 2001-2016 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; const int Maxn = 100005; int n, q, tree_ct, k[Maxn], r[Maxn], ord[Maxn], Head[Maxn]; struct Tree { int lson, rson; long long k, b; } tree[24 * Maxn]; void build_first(int root, int lt, int rt) { if (lt + 1 == rt) tree[root].k = k[lt], tree[root... |
//
// Title : Software Wishbone master unit for testbenches
//
// File : wishbone_master_tb.v
// Author : Tomasz Wlostowski <>
// Created : Tue Mar 23 12:19:36 2010
// Standard : Verilog 2001
//
// Modified by Lucas Russo <>
// date: 04/10/2012
`include "defines.v"
// Default va... |
// file: clk_wiz_v3_3.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 is not... |
// $Id: rtr_crossbar_mac.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, 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:
Redistribut... |
// Copyright 2020-2022 F4PGA Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a < b) swap(a, b); while (b) { long long t = b; b = a % b; a = t; } return a; } long long mul(long long a, long long b, long long m) { long long q = (long double)a * (long double)b /... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_l2_buf2.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/o... |
#include <bits/stdc++.h> using namespace std; template <typename T> bool vmin(T& a, T b) { return (a > b) ? (a = b, true) : (false); } template <typename T> bool vmax(T& a, T b) { return (a < b) ? (a = b, true) : (false); } template <typename T> T smax(T x) { return x; } template <type... |
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(false); cin.tie(0); long int n; cin >> n; const long int N = n; char s[N]; int cnt0 = 0, cnt1 = 0; for (int i = 0; i < n; i++) { cin >> s[i]; if (s[i] == z ) { cnt0++; } if... |
#include <bits/stdc++.h> using namespace std; inline int read() { char ch = getchar(); int nega = 1; while (!isdigit(ch)) { if (ch == - ) nega = -1; ch = getchar(); } int ans = 0; while (isdigit(ch)) { ans = ans * 10 + ch - 48; ch = getchar(); } if (nega == -... |
/**
* 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> int main() { int input, max = 0, temp1, temp2; scanf( %d , &input); for (int i = 1; i <= input; i++) { if (input % i == 0) { temp1 = input / i; temp2 = i; if (temp1 <= temp2) { break; } } } printf( %d %d n , temp1, temp... |
#include <bits/stdc++.h> using namespace std; int main() { int(n); scanf( %d , &(n)); int val[100001][2]; double arr[100001]; for (int i = 1; i <= n; i++) cin >> arr[i]; int sum = 0; for (int i = 1; i <= n; i++) { int t = arr[i]; if (arr[i] - t != 0) { if (t > 0) { ... |
//----------------------------------------------------------------------------
// Copyright (C) 2015 Authors
//
// This source file may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notic... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2016 by Geoff Barrett.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
// verilator lint_off LITENDIAN
l... |
/**
* 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 n = 0, m = 0; cin >> n; vector<int> hit(n, -1); map<int, pair<int, int> > circle; for (int i = 0; i < n; i++) { int c, r; cin >> c >> r; circle.insert(make_pair(c, make_pair(r, i))); } int hits = 0; 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> int main() { long long n, m; int dig[10]; char cn[12], cm[12]; while (scanf( %s n%s , &cn, &cm) != EOF) { if (strlen(cn) != strlen(cm)) { printf( WRONG_ANSWER n ); continue; } n = atol(cn); m = atol(cm); for (int i = 0; i < 10; i++... |
// Copyright (c) 2014 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
#include <bits/stdc++.h> using namespace std; long long dx[8] = {0, 1, 0, -1, 1, 1, -1, -1}; long long dy[8] = {1, 0, -1, 0, -1, 1, 1, -1}; class pa3 { public: long long x; long long y, z; pa3(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {} bool operator<(const pa3& p... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:268435456 ) using namespace std; const double PI = 3.1415926535897932384626433832795; template <class T> T min(T &a, T &b) { return (a < b) ? a : b; } template <class T> T max(T &a, T &b) { return (a > b) ? a : b; } template <class T> ... |
// megafunction wizard: %ALTERA_FP_FUNCTIONS v15.1%
// GENERATION: XML
// xlr8_float_mult2.v
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module xlr8_float_mult2 (
input wire clk, // clk.clk
input wire areset, // areset.reset
input wire [0:0] en, // en.en
inp... |
#include <bits/stdc++.h> using namespace std; void sprint(string s) { for (int i = 0; i < (int)s.size(); ++i) printf( %c , s[i]); printf( n ); } long long f(long long n, long long r) { long long ans = 1; for (long long i = 0; i < r; ++i) { ans = (ans * (n - i)) / (i + 1); } return... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2014 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Vers... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int MAXN = 5e5 + 10; bool bio[MAXN]; int n; int a[MAXN], b[MAXN], aa[MAXN], bb[MAXN]; int deg[1 << 20]; map<pair<int, int>, vector<int>> id; vector<pair<int, int>> e[1 << 20]; stack<int> path; bool euler(int x, bool print... |
#include <bits/stdc++.h> using namespace std; bool ch[30]; int whenlast[30]; char g[1000005]; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { scanf( %c , &g[i]); whenlast[g[i] - A ] = i; } int rlt = 0, ans = 0; for (int i = 0; i < n; i++) { ch[g[... |
`ifdef BSV_ASSIGNMENT_DELAY
`else
`define BSV_ASSIGNMENT_DELAY
`endif
`ifdef BSV_POSITIVE_RESET
`define BSV_RESET_VALUE 1'b1
`define BSV_RESET_EDGE posedge
`else
`define BSV_RESET_VALUE 1'b0
`define BSV_RESET_EDGE negedge
`endif
module MakeResetA (
CLK,
RST,
ASSERT_IN,
ASSER... |
#include <bits/stdc++.h> using namespace std; unsigned int max_ID(long long int a[], long long int b[], unsigned int n) { unsigned int max_ID; unsigned long long int max; max_ID = 0; max = pow(a[0] - b[0], 2); for (unsigned int i = 1; i < n; i++) { if (pow(a[i] - b[i], 2) > max) { ... |
module wasca (
altpll_0_areset_conduit_export,
altpll_0_locked_conduit_export,
altpll_0_phasedone_conduit_export,
audio_out_BCLK,
audio_out_DACDAT,
audio_out_DACLRCK,
clk_clk,
clock_116_mhz_clk,
external_sdram_controller_wire_addr,
external_sdram_controller_wire_ba,
external_sdram_controller_wire_cas_n,
ex... |
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; const int maxRounds = 200000; double p[110], ans, pw[110][maxRounds + 10]; int times[110], n; int main() { cin >> n; if (n == 1) { cout << 1; return 0; } for (int i = 1; i <= n; ++i) { int first; cin >> first; p[i] = f... |
#include <bits/stdc++.h> using namespace std; int dp[1000007]; int main() { int n; scanf( %d , &n); dp[1] = dp[2] = 1; for (int i = 3; i <= n; i++) { int im = (i - 1) / 2; if (2 * im == (i - 1) && im % 2 == 0) dp[i] = dp[im]; else if ((2 * im + 1) == (i - 1)) dp[i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
* 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 abc { long long int y, x; }; bool compare(abc a1, abc a2) { if (a1.x == a2.x) return a1.y < a2.y; return a1.x < a2.x; } long long int countDivisors(long long int n) { long long int cnt = 0; for (long long int i = 1; i <= sqrt(n); i++) ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T checkmin(T &a, T b) { return (a < b) ? a : a = b; } template <class T> inline T checkmax(T &a, T b) { return (a > b) ? a : a = b; } template <class T> T GCD(T a, T b) { if (a < 0) return GCD(-a, b); if (b < 0) re... |
#include <bits/stdc++.h> using namespace std; int main(void) { srand(time(0)); cout << fixed << setprecision(7); cerr << fixed << setprecision(7); int n, q; scanf( %d%d , &n, &q); static long long s[1 << 23]; for (int i = 1; i <= n; ++i) scanf( %I64d , &s[i]), s[i + n] = s[i + n + ... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void mine(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void maxe(T1 &x, T2 y) { if (x < y) x = y; } ostream &operator<<(ostream &a, const vector<long long> &b) { for (aut... |
#include<iostream> #include<bits/stdc++.h> using namespace std; typedef long long int ll; ll max(ll a,ll b){ if(a>b)return a; return b; } int main(){ int T; cin>>T; while(T--){ int n,k; cin>>n>>k; string s1,s2; cin>>s1; cin>>s2;... |
#include <bits/stdc++.h> using namespace std; const int A = 1e7 + 10; const int B = 1e6 + 10; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; inline int read() { char c = getchar(); int x = 0, f = 1; for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = g... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
/**
* Design of the noise generator that produces bits to corrupt
* the encoded data bits that are transmitted in the communications
* channel
*/
module noise_generator (error, noise,err_level);
// Output signals for the design module
/**
* P... |
/*
* 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 (c) 1999 Steven Wilson ()
//
// 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 a, q, w, t; int main() { cin >> a; cout << (a + 1) / 36 << << (a + 1) % 36 / 3; } |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; while (n--) { cout << 1 << ; } cout << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { solve(); } return 0; } |
#include <bits/stdc++.h> int main() { int n, m1, m2, m3, min1, min2, min3, max1, max2, max3; scanf( %d%d%d%d%d%d%d , &n, &min1, &max1, &min2, &max2, &min3, &max3); m1 = n - min2 - min3; if (m1 <= max1) printf( %6d %6d %6d , m1, min2, min3); else { m2 = min2 + m1 - max1; if (m2 < ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; if (tmp % 2) cout << tmp << ; else cout << tmp - 1 << ; } cin.get(); cin.get(); } |
#include <bits/stdc++.h> using namespace std; struct node { int len, l, r; bool operator<(const node &a) const { return len > a.len; } }; int day[200010]; int m[200010]; int main() { int n, k, c, i, j; scanf( %d %d , &n, &k); c = 0; for (i = 0; i < n; i++) { scanf( %d , &day[i]... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/jp.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the followi... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000009, N = 4005; int cal[N][N], fac[N]; inline int add(int a, int b) { if (a < 0) a += mod; if (b < 0) b += mod; int ret = a + b; if (ret >= mod) return ret %= mod; else return ret; } inline int mul(int a, int... |
#include <bits/stdc++.h> using namespace std; int main() { int t; string str; cin >> t; while (t--) { cin >> str; sort(str.begin(), str.end()); int sz = str.size(); if (str[0] == str[sz - 1]) cout << -1 << endl; else cout << str << endl; } return... |
#include<bits/stdc++.h> using namespace std; typedef long long int ll; ll mod=1e9+7; ll get(ll x,ll y) { ll z; cout<< ? <<x<< <<y<<endl; cin>>z; return z; } int main() { #ifndef ONLINE_JUDGE freopen( input.txt , r ,stdin); freopen( output.txt , w ,std... |
// ***************************************************************************
// ***************************************************************************
// 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; string a, b; int i, ax, ay, bx, by; int main() { cin >> a >> b; for (i = 0; i < a.length(); i++) if (a[i] == 1 ) ax++; else ay++; for (i = 0; i <= b.length(); i++) if (b[i] == 1 ) bx++; else by++;... |
#include <bits/stdc++.h> using namespace std; int main(int argc, const char* argv[]) { int n, maxf; cin >> n; int h[n]; for (int i = 0; i < n; i++) cin >> h[i]; maxf = h[n - 1]; h[n - 1] = 0; for (int i = n - 2; i >= 0; i--) { if (h[i] > maxf) { maxf = h[i]; h[i] = ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int mxn = 1e5 + 5; const int inf = 1e9; vector<int> adj[mxn]; bool f1[mxn], f2[mxn]; bool done; int ask(char x, int y) { cout << x << << y << endl; int r; cin >> r; return r; } int dfs(int cur, int prev) { if (done) return -1;... |
#include <bits/stdc++.h> using namespace std; long long arr1[26], arr2[26][26]; signed main() { string s; cin >> s; long long n = s.length(); for (long long i = 0; i < n; i++) { long long ct = s[i] - a ; for (long long j = 0; j < 26; j++) { arr2[j][ct] += arr1[j]; } ... |
module test(I1,I2,I3,I4,enter,win,lose,reset,equal,bigger,smaller,nums,CLK,outs,numa);
input CLK;
wire good;
output reg outs;
reg[0:22] out;
always @(posedge good or posedge reset) begin
if(reset)
outs = 0 ;
else
outs = ~outs;
end
always @(posedge CLK or posedge reset) begin
if(reset)
out = 0 ;
... |
//==================================================================================================
// Filename : Testbench_simpleAdders.v
// Created On : 2016-11-18 02:54:20
// Last Modified : 2016-11-18 17:52:24
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tec... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; if (n < k) cout << k - n << endl; else { if ((n & 1) == (k & 1)) cout << 0 << endl; else cout << 1 << endl; } }... |
#include <bits/stdc++.h> using namespace std; const long long MAGIC = 777777777; struct point { long long x, y, z; point() {} point(long long val) { x = y = z = val; } }; vector<point> arr; struct equation { pair<long long, long long> S; pair<long long, long long> a; pair<long long, ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100, maxp = 20; int n, a[maxp][maxp], ma[(1 << maxp)], cur[1 << maxp], dp[1 << maxp], cnt[maxn], f[maxp][maxn]; int ans, mp, p; char s[maxn]; vector<int> pos[20]; void solve() { dp[mp] = 1; for (int i = mp; i >= 0; i--) { ... |
#include <bits/stdc++.h> using namespace std; int k; int main() { cin >> k; for (int i = 1; i < k; i++) { cout << i; for (int j = 2; j < k; j++) { if (i * j < k) cout << << i * j % k; else cout << setw(2) << i * j / k << i * j % k; } cout <<... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Memory_16x256.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============... |
#include <bits/stdc++.h> using namespace std; bool is_integer(long double k) { return std::floor(k) == k; } int main() { long long i, j = 0; string s; cin >> s; if (s.length() == 1 && s[0] == 0 ) { cout << 0; return 0; } int c = 0; for (i = (s.length() - 1); i >= 0; i--) {... |
#include <bits/stdc++.h> using namespace std; long long q, n; int main() { cin >> q; for (int i = 0; i < q; i++) { cin >> n; vector<long long> nums; long long cSum = 0, power = 0; while (cSum < n) { cSum += pow(3, power); nums.push_back(pow(3, power)); power... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
#include <bits/stdc++.h> using namespace std; int main() { int *xi, *di, n; cin >> n; xi = new int[n]; di = new int[n]; for (int i = 0; i < n; i++) cin >> xi[i] >> di[i]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (xi[i] + di[i] == xi[j] && xi[j] + di[j] == ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using Vi = vector<int>; using Pii = pair<int, int>; int uplg(int n) { return 32 - __builtin_clz(n); } int uplg(ll n) { return 64 - __builtin_clzll(n); } void run(); int main() { cin.sync_with_stdio(0); cin.tie(0); cout << fi... |
#include <bits/stdc++.h> const long long INF = (1e9 + 12312), MOD = 1e9 + 7; const long double EPS = 0.0000000001; using namespace std; bool ask(long long first, long long second) { cout << first << << second << endl; string s; cin >> s; if (s == Bad ) { exit(1); } return s ==... |
///////////////////////////////////////////////////////////////////////////////
// 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; template <typename T> void setmax(T& x, T y) { x = max(x, y); } template <typename T> void setmin(T& x, T y) { x = min(x, y); } const double PI = acos(-1.0); const long long INF = 1e9 + 47; const long long LINF = INF * INF; mt19937 rng(chrono::... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int T, cnt = 0; cin >> T; while (T--) { long long int k, n, a, b; cin >> k >> n >> a >> b; k -= n * a; if (k > 0) cout << n << n ; else { k ... |
#include <bits/stdc++.h> using namespace std; int newMask[1000000][4]; bool canMove[1000000][4]; int mv[][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; int len; int getMove(int x, int y) { if (x == 1 && y == 0) return 0; if (x == 0 && y == 1) return 1; if (x == -1 && y == 0) return 2; return 3; ... |
//
// Designed by Qiang Wu
//
`timescale 1ns/1ps
`include "NF_2.1_defines.v"
`include "registers.v"
`include "reg_defines_reference_router.v"
module packet_buffer_bypass(
input clk,
input reset,
output [239:0] TRIG0,
input [63:0] in_data,
input [23:0] in_pkt_route,
input in_wr,
output reg in_empty,... |
#include <bits/stdc++.h> using namespace std; struct data { int a, b, c, d; data() {} data(int a, int b, int c, int d) : a(a), b(b), c(c), d(d) {} }; const int MAX = 100500; data info[MAX]; int main() { std::ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; info[0] = dat... |
`timescale 1ns / 100ps
module uartlib(
input UART_CLK, output reg UART_TX
);
integer counter;
initial
UART_TX = 1;
task write_byte;
input [7:0] data;
begin
//start bit
$display("write_byte: 0x%x (0b%b) [%c]", data, data, data);
rep... |
module TMP421 (
(* intersynth_port = "Reset_n_i" *)
input Reset_n_i,
(* intersynth_port = "Clk_i" *)
input Clk_i,
(* intersynth_port = "ReconfModuleIn_s", intersynth_conntype = "Bit" *)
input Enable_i,
(* intersynth_port = "ReconfModuleIRQs_s", intersynth_conntype = "Bit" *)
output CpuIntr_o,
(* inter... |
/**
* 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... |
`default_nettype none
module module_scope_Example(o1, o2);
parameter [31:0] v1 = 10;
parameter [31:0] v2 = 20;
output wire [31:0] o1, o2;
assign module_scope_Example.o1 = module_scope_Example.v1;
assign module_scope_Example.o2 = module_scope_Example.v2;
endmodule
module module_scope_ExampleLong(o1, o2)... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:48:59 03/24/2015
// Design Name:
// Module Name: Adder32
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> int main() { long long t, i, x, y, a, b; scanf( %lld , &t); for (i = 1; i <= t; i++) { scanf( %lld%lld%lld%lld , &x, &y, &a, &b); if ((y - x) % (a + b) == 0) printf( %lld n , (y - x) / (a + b)); else printf( -1 n ); } return 0; } |
//------------------------------------------------------------------------------
//
// Copyright 2011, Benjamin Gelb. All Rights Reserved.
// See LICENSE file for copying permission.
//
//------------------------------------------------------------------------------
//
// Author: Ben Gelb ()
//
// Brief Description:
//... |
#include <bits/stdc++.h> using namespace std; struct option { int s; int t; bool operator<(const option &next) const { if (this->s == next.s) return this->t < next.t; else return this->s < next.s; } }; vector<int> num1; vector<int> num2; vector<option> oLis; int... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.