text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int64_t N = 5e6 + 10; int64_t n, m; int64_t it[N]; bool hamband[N]; int64_t adj[N]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; if (m == (n - 1) * n >> 1) { cout << 0; return 0; ... |
#include <bits/stdc++.h> using namespace std; int n, m; const int N = 1005; char grid[N][N]; int visited[N][N]; bool row[N]; bool col[N]; int drow[] = {0, 0, -1, 1}; int dcol[] = {1, -1, 0, 0}; bool fullrow = false; bool fullcol = false; bool inside(int x, int y) { return (1 <= x && x <= n && 1 ... |
/**
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:01:49 01/04/2015
// Design Name:
// Module Name: neopixel_tx
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2007 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
supply0 ... |
/**
* 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; string proc(char *a) { int n = strlen(a); char s[100]; int i = 0, j = 0; while (i < n) { if (a[i] == u ) s[j++] = o , s[j++] = o ; else s[j++] = a[i]; i++; } s[j] = 0 ; strcpy(a, s); n = j; i = j... |
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 5; int n, f[N]; long long a[N], b[N], c[N]; int main() { cin >> n; for (int i = 1; i <= n; i++) { scanf( %I64d , a + i); a[n + 1] = 1; long long t = a[i]; while (t % 2 == 0) t /= 2, b[i]++; c[i] = t; } ... |
// File: BDCLed_TBV.v
// Generated by MyHDL 0.10
// Date: Mon Aug 20 12:45:05 2018
`timescale 1ns/10ps
module BDCLed_TBV (
);
// myHDL -> Verilog Testbench for `BDCLed`
reg clk = 0;
wire [1:0] sw;
reg [3:0] led = 0;
wire [7:0] BDCLed0_0_duty_led;
reg [7:0] BDCLed0_0_counter = 0;
assign sw = 2'd0;
assign BDCLed0_... |
/*
* 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; vector<int> v, vv, vv2; int main() { long long t, n, a[1000], k, f = 0; cin >> n; string s; cin >> s; int cnt = 0; for (int i = 0; i < s.size() && cnt >= -1; i++) { if (s[i] == ( ) cnt++; else cnt--; } if (!... |
#include <bits/stdc++.h> using namespace std; const long long modn = 1000000007; inline long long mod(long long x) { return x % modn; } int n; vector<int> v[30]; int qt[30]; int main() { int i, j; string s; cin >> s; n = s.size(); for (i = 0; i < n; i++) v[s[i] - a ].push_back(i); ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long cur = 1; long long ans = 0; long long now = n; while (cur <= now) { now -= cur; cur *= 2; ans++; } if (now != 0) ans++; cout << ans << endl; return 0; } |
`timescale 1 ns / 1 ps
`include "pwm_v1_0_tb_include.vh"
// lite_response Type Defines
`define RESPONSE_OKAY 2'b00
`define RESPONSE_EXOKAY 2'b01
`define RESP_BUS_WIDTH 2
`define BURST_TYPE_INCR 2'b01
`define BURST_TYPE_WRAP 2'b10
// AMBA AXI4 Lite Range Constants
`define S00_AXI_MAX_BURST_LENGTH 1
`define S00_AXI... |
// (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; using ll = long long; const int NAX = 2e5 + 5, MOD = 1000000007; struct Node { set<pair<int, int>> vals; Node() {} Node lazylazyMerge(const Node &rhs) {} Node seglazyMerge(const Node &rhs, const int &l, const int &r) {} Node segSegMerge(const Nod... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 998244353; void add(int& a, int b) { a += b; if (a >= MOD) a -= MOD; } int mul(int a, int b) { return ll(a) * b % MOD; } int modinv(int a, int m = MOD) { return a == 1 ? a : m - modinv(m % a, a) * ll(m) / a; ... |
module junsignedArrayMultiplierTb;
wire [7:0] Y;
reg [3:0] A, B;
junsignedArrayMultiplier juam(Y, A, B);
initial
begin
$display("RSLT\tA x B = Y");
A = 2; B = 2; #10;
if ( Y == 4 )
$display("PASS\t%p x %p = %p",A,B,Y);
else
$display("FAIL\t%p x %p = %p",A,B,Y);
A = 3; B =... |
//----------------------------------------------------------------------------
//-- Unidad de recepcion serie asincrona
//------------------------------------------
//-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//--------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; bool isPowerOfTwo(int x) { return (x && !(x & (x - 1))); } bool is_prime(int n) { if (n == 1) return false; for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } void solve() { int n; ci... |
module DFF
(output reg Q0,
output reg [1:0] Q1,
input wire D0,
input wire [1:0] D1,
input wire CLK,
input wire RST
/* */);
always @(posedge CLK or posedge RST)
if (RST) begin
Q0 <= 0;
Q1 <= 0;
end else begin
Q0 <= D0;
Q1 <= D1;
end
endmodule // dut
module main;
wire ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const long long INF = 1e18; long long n, sum, ans; long long a[200010]; struct BIT { long long tree[600010]; BIT() { memset(tree, 0, sizeof(tree)); } void update(long long i, long long x) { while (i <= 600000) { tre... |
#include <bits/stdc++.h> using namespace std; int N, T; char str[15], temp[15]; int main() { int i, j, k; scanf( %s%s , str, temp); i = strlen(str); sort(str, str + i); if (str[0] == 0 ) { do { if (str[0] != 0 ) break; } while (next_permutation(str, str + i)); } ... |
#include <bits/stdc++.h> using namespace std; struct que { int l, r, y, val; bool operator<(const que &v) const { return y < v.y; } }; int n, k, x[100010], y[100010], cnt[100010 * 2], pre[100010 * 2]; long long ans[100010]; vector<que> q; vector<int> h; int main() { scanf( %d%d , &n, &k); ... |
#include <bits/stdc++.h> using namespace std; void fast(); int main() { fast(); int k, d; cin >> k >> d; string ans = ; if ((d > (pow(10, k) - 1)) || (d == 0 && k != 1)) { cout << No solution ; return 0; } for (int i = 0; i < k; i++) { if (d > 9) { ans += ... |
/**
* 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; long long add(long long n) { long long mi = INT_MAX, ma = INT_MIN; while (n > 0) { mi = min(n % 10, mi); ma = max(n % 10, ma); n = n / 10; } return mi * ma; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ... |
#include <bits/stdc++.h> using namespace std; int main() { int a[7]; while (scanf( %d , &a[0]) != EOF) { int maxx = a[0]; int minn = a[0]; int ans = 0; for (int i = 1; i < 6; i++) { cin >> a[i]; } ans = (a[0] + a[1] + a[2]) * (a[0] + a[2] + a[1]) - a[0] * a[0] - ... |
// Copyright (c) 2014 Takashi Toyoshima <>.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
module SerialReceiver(
clk_x4,
rst_x,
i_rx,
o_data,
o_valid,
o_error);
input clk_x4;
input rst_x;
input ... |
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pii pair <ll, ll> #define mp make_pair // const int inf = 1e9 + 111; const int NMAX = 200111; const int inf = 1e9 + 7; const ld eps = 0.00000000001; const ll mod = 1e9 + 7; constexpr int64... |
#include <bits/stdc++.h> using namespace std; int n, m; string grid[101]; int nb, l = 200, r = -1, u = 200, d = -1; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) cin >> grid[i]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) if (grid[i][j] == B ) { ... |
#include <bits/stdc++.h> using namespace std; deque<int> d[100005]; int v[100005]; int p[100005]; pair<int, int> q[100005]; int ans = 0; int prog = 0; int as[100005]; unordered_map<int, int> possible[100005]; bool cmp(int a, int b) { if (q[a].first / 300 != q[b].first / 300) return q[a].fi... |
/**
* 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, a, i, j, arr[300] = {0}, p = 0, k = 0, c, d; cin >> n >> a; for (i = 1; i < n + 1; i++) { cin >> arr[i]; } arr[0] = 1, arr[n + 1] = 1; j = min(a, n - a + 1); for (i = j; i < n + 1; i++) { c = a + k; d = a... |
#include <bits/stdc++.h> using namespace std; const long long int inf = 2000000000; const long double eps = 0.0000001; const long double pi = acos(-1.0); const long long int MOD = 998244353; const long long int N = 1e5 + 5; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(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 law... |
/**
* $Id: red_pitaya_ams.v -01-21 11:40:39Z matej.oblak $
*
* @brief Red Pitaya analog mixed signal.
*
* @Author Matej Oblak
*
* (c) Red Pitaya http://www.redpitaya.com
*
* This part of code is written in Verilog hardware description language (HDL).
* Please visit http://en.wikipedia.org/wiki/Verilog
* for... |
#include <bits/stdc++.h> using namespace std; using namespace std; long long int **sparse; void buildSparseTable(long long int arr[], long long int n, long long int **sparse) { for (long long int i = 0; i < n; i++) { sparse[i][0] = i; } for (long long int j = 1; pow(2, ... |
#include <bits/stdc++.h> using namespace std; int n, a[3]; int dp[310][310]; string name[2] = { BitAryo , BitLGM }; int mem(int x, int y) { if (dp[x][y] != -1) return dp[x][y]; int mn = 1; for (int i = 1; i <= x; i++) mn = min(mn, mem(x - i, y)); for (int i = 1; i <= y; i++) mn = min(mn, mem(... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int num[5005], cnt[5005] = {}, id[5005]; int dp[5005][5005]; bool used[5005]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> num[i]; sort(num + 1, n... |
#include <bits/stdc++.h> using namespace std; void vin(vector<long long int> &v, long long int t) { for (long long int i = 0; i < t; i++) cin >> v[i]; } void vout(vector<long long int> &v, long long int t) { for (long long int i = 0; i < t; i++) cout << v[i] << ; cout << endl; } void ingraph(... |
/*
* 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, a, b, c, ans, boby, apu; cin >> n; while (n--) { cin >> a >> b >> c >> ans; boby = b - a; apu = c + ans; if (boby % apu == 0) { cout << boby / apu << endl; } else cout << -1 << endl; ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
mod... |
module dut(/*AUTOARG*/
// Outputs
dut_active, clkout, wait_out, access_out, packet_out,
// Inputs
clk1, clk2, nreset, vdd, vss, access_in, packet_in, wait_in
);
parameter N = 1;
parameter PW = 104;
//clock, reset
input clk1;
input clk2;
input nr... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:536870912 ) const int MOD = 1000000007; const int INF = 1000000001; const int MAXN = 17; const long double EPS = 1e-6; const int HASH_POW = 29; const long double PI = acos(-1.0); using namespace std; void my_return(int code) { exit(code); } in... |
// (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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2011 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.
module t (/*AUTOARG*/
// Inputs
... |
(** Responses from the server. *)
Require Import ListString.All.
Require Http.
Require Import Model.
(** Sum type of the responses. *)
Inductive t :=
(** Errors. *)
| NotFound | WrongArguments | Forbidden
(** Static content from the `static/` folder. *)
| Static (mime_type : LString.t) (content : LString.t)
(** Confir... |
module RegisterFileTestBench3;
parameter sim_time = 750*2; // Num of Cycles * 2
reg [31:0] in,Pcin;
reg [19:0] RSLCT;
reg Clk, RESET, LOADPC, LOAD,IR_CU;
wire [31:0] Rn,Rm,Rs,PCout;
//RegisterFile(input [31:0] in,Pcin,input [19:0] RSLCT,input Clk, RESET, LOADPC, LOAD,IR_CU, output [31:0] Rn,Rm,Rs,PCout);
RegisterFil... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyr... |
#include <bits/stdc++.h> using namespace std; int ted[1010]; int main() { memset(ted, 0, sizeof ted); int n; cin >> n; while (n--) { int x; cin >> x; ted[x]++; } int ans = 0; int mx = 0; for (int i = 1; i <= 1000; i++) if (ted[i]) { ans++; mx... |
////////////////////////////////////////////////////////////////////////////////////
//
// pGB, yet another FPGA fully functional and super fun GB classic clone!
// Copyright (C) 2015-2016 Diego Valverde ()
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GN... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/24 23:33:19
// Design Name:
// Module Name: lab1_4_2
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revi... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); printf( %d , n); for (int i = 1; i < n; i++) { printf( %d , i); } return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 50; const int maxm = 1e6 + 50; const double eps = 1e-10; const int max_index = 62; const int inf = 0x3f3f3f3f; const int MOD = 1e9 + 7; inline int read() { char c = getchar(); while (!isdigit(c)) c = getchar(); int x = 0; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; int k, q; long long f[10], dp[maxn]; void update(long long v, long long w) { for (int i = 1000000; i >= w; i--) dp[i] = max(dp[i], dp[i - w] + v); return; } void solve(long long v, long long w) { int num = min((long long)... |
#include <bits/stdc++.h> using namespace std; int fin[100005]; int main() { int n; while (cin >> n) { int l, r; int flag = 1; int temp; for (int i = 0; i < n; i++) { cin >> l >> r; if (i == 0) fin[0] = l > r ? l : r; else { temp = l > r ?... |
/**
* 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... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
/**
* 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 wasca (
abus_avalon_sdram_bridge_0_abus_address,
abus_avalon_sdram_bridge_0_abus_read,
abus_avalon_sdram_bridge_0_abus_waitrequest,
abus_avalon_sdram_bridge_0_abus_addressdata,
abus_avalon_sdram_bridge_0_abus_chipselect,
abus_avalon_sdram_bridge_0_abus_direction,
abus_avalon_sdram_bridge_0_abus_disable_o... |
/**
* 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> constexpr int MAXN = 1e2 + 2; constexpr int MAXE = 1e4 + 4; using namespace std; int n; vector<double> choc, prefixSum, suffixSum, cpy; int main() { std::ios::sync_with_stdio(false); cin >> n; choc.resize(n), prefixSum.resize(n), suffixSum.resize(n); for (int i = 0; ... |
#include <bits/stdc++.h> using namespace std; long long int n; set<long long int> nos; long long powmod(long long x, long long y, long long m) { long long res = 1LL; while (y) { if (y & 1) res = (res * x) % m; x = (x * x) % m; y /= 2; } return res; } int main() { ios_ba... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-12; int main() { int n; double r, v, T; scanf( %d%lf%lf , &n, &r, &v); T = 2 * acos(-1) * r / v; for (int i = 0; i < n; i++) { double s, f, tim, tot = 0; scanf( %lf%lf , &s, &f); tim = (f - s) / v; tot ... |
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_str... |
#include <bits/stdc++.h> using namespace std; int n, d, v[102], c, g[102], k, S; int main(void) { cin >> n >> d; for (int i = 1; i <= n; i++) cin >> v[i]; for (int i = 1; i < n; i++) { if (v[i] % 2) c++; else c--; if (c == 0) g[k++] = abs(v[i] - v[i + 1]); } s... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, t, k, ret; int a[N]; int sum[N]; int main() { scanf( %d%d%d , &n, &t, &k); int all = 0; sum[0] = 1; a[0] = 1; for (int i = 1; i <= t; i++) { scanf( %d , &a[i]); sum[i] = sum[i - 1] + a[i]; if (a[... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; const int inf = 0x3f3f3f3f; int n, m; long long ans; long long b[maxn], g[maxn]; bool cmp(int a, int b) { return a > b; } int main() { long long bmx = 0; int flag = 1, cnt = 0; scanf( %d%d , &n, &m); for (int i = 1... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, t, z = 0; cin >> n >> t; if (n == 1 && t == 10) cout << -1 << endl; else if (t == 10) { for (int i = 0; i < n - 1; i++) { cout << 1; } ... |
`timescale 1ns/1ns
module mips(clk, rst, PrAddr, PrBe, PrRD, PrWD, HWInt);
input clk ;
// clock
input rst ;
// reset
output [31:0] PrWD;
output [31:2] PrAddr;
output [3:0] PrBe;
input [31:0] PrRD;
input [7:2] HWInt;
wire BJ_W,CMPSrc;
wire JType;
w... |
#include <bits/stdc++.h> struct { inline operator int() { int x; return scanf( %d , &x), x; } inline operator long long() { long long x; return scanf( %lld , &x), x; } template <class T> inline void operator()(T &x) { x = *this; } template <class T, class.... |
/**
* 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 N = 1000005; const int CS = 22; int cmax[N][CS], cmin[N][CS], ans[N]; int lt[CS]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %d , &cmax[i][0]); cmax[i][0] *= 100; } for (int i = 1... |
/* This file is part of JT12.
JT12 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.
JT12 program is distribute... |
//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 associated do... |
#include <bits/stdc++.h> using namespace std; inline long long add(long long a, long long b, long long p = 1000000007) { long long c = a + b; if (c >= p) c -= p; return c; } inline long long sub(long long a, long long b, long long p = 1000000007) { long long c = a - b; if (c < 0) c += p; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d%d , &n, &m); vector<vector<pair<int, int> > > e(n, vector<pair<int, int> >()); for (int i = 1; i < n; ++i) { int u, v, d; scanf( %d%d%d , &u, &v, &d); e[--u].push_back(make_pair(--v, d)); } vecto... |
/*******************************************************************************
* 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 with non-Xilinx ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:04:40 05/25/2015
// Design Name:
// Module Name: seven_segment_leds_x_8
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> int main() { int i, j, k, p, r, n, c = 0; scanf( %d , &n); char s[1000000]; scanf( %s , s); for (i = 0; i < n - 2; i++) { if (s[i] == s[i + 1]) { c++; if (s[i] == G ) { if (s[i + 2] == R ) s[i + 1] = B ; else if (s[i... |
#include <bits/stdc++.h> using ll = long long; const ll LINF = 1e13; using namespace std; namespace ProconLib { template <typename cost_t = long long, bool hasNegativeCost = false, cost_t INF = LINF> class Flow { public: struct Edge { int to; cost_t cap, rev; cost_t cost... |
// file: Test_AXI_Master_simple_v1_0_hw_1_clk_wiz_0.v
//
// (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
// laws.
//
// DISCLA... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 200020; int n, a[Maxn]; long long sum[Maxn]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , a + i); for (int i = 0; i < n - 1; i++) { int cur; for (cur = 1; cur <= i;) { int val = i / cur; ... |
#include <bits/stdc++.h> using namespace std; void fio() {} void pti() { double timeuse = clock() * 1000.0 / CLOCKS_PER_SEC; cerr << Timeuse << timeuse << ms << endl; } void end() { exit(0); } namespace io { const int SIZ = 55; int que[SIZ], op, qr; char ch; template <class I> inline ... |
//
// Maintains the replacement policy for an array of elements
// The scheme is synchronously updated when v_i goes high, and asynchronously
// outputs the selected way for replacement based on internal and emptiness
//
// Currently supported schemes
// LRU:
// - Both alloc and read operations update LRU in paral... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1010 + 1; const double EPS = 1E-8; int n; double a[MAXN], low[MAXN], high[MAXN], mmin, mmax; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %lf , &a[i]); if (i) { low[i] = 10 * a[i] / (i + 1); ... |
/*
Copyright (C) 2016
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 to in writing, software
distribute... |
#include <bits/stdc++.h> using namespace std; int arr[1001][1001]; int main() { int n, m, f1 = 0; cin >> n >> m; int cnt = m; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i != j && arr[i][j] == 0) { arr[i][j] = 1; arr[j][i] = -1; cnt--... |
/*
* I2S shift in function. Data interface is a FIFO. FIFO is assumed to be dual-clock.
* There will be no writes if not enabled.
* New values will be written to FIFO only when fifo_ready. If enabled, but not ready,
* the last data sample will be dropped.
*/
module i2s_shift_in (
input clk, // Master clo... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long double P = 3.1415926536, a[110], n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; a[i] *= a[i]; a[i] *= P; } for (int i = 0; i < n; i++) for (int j = 0; j < n - 1;... |
/*
* Copyright 2017 Google 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define N 1010100 #define inf 1e9 #define loop(x, n, r) for(int i = x; i < n; i += r) #define pb push_back #define pp pair<int, int> using namespace std; int main(){ ios::sync_with_stdio(0); cin.ti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.