text stringlengths 59 71.4k |
|---|
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_top.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100100; struct node { long long l, r; long long color; long long sum; long long change; } tree[maxn << 2]; long long n, m; int a[maxn]; void pushup(long long cur) { if (tree[cur * 2].color == tree[cur * 2 + 1].color) ... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
#include <bits/stdc++.h> using namespace std; const int inf = 2e9 + 1e8; const long long INF = 2e18 + 1e17; const int mod = 998244353; const int MOD = 1e9 + 7; long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } bool is_prime(int x) { if (x <= 1 || (x % 2 == 0 && x > 2)) r... |
#include <bits/stdc++.h> const int INF = 1e9; using namespace std; void dfs(int v, int p, vector<vector<int> > &graph, vector<int> &sz) { sz[v] = 1; for (auto u : graph[v]) if (u != p) { dfs(u, v, graph, sz); sz[v] += sz[u]; } } void dfs(int v, int p, vector<vector<int> > &... |
#include <bits/stdc++.h> using namespace std; const long long inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3fLL; const long long mod = 1e9 + 7; long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res *... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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 Found... |
`timescale 1 ns / 1 ps
`include "Eight_Digit_Seven_Segment_Display_v2_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_... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:41:39 04/21/2015
// Design Name: e_finder
// Module Name: H:/Users/ll024/Downloads/PrimeFactorization (1)/PrimeFactorization/PrimeFactorization/test_e_finder.v
// ... |
#include <bits/stdc++.h> using namespace std; int n, d, res; int a[200005]; int main() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; if (a[i] == 2) d++; } if (d <= n / 2) { res += d; n -= 2 * d; res += n / 3; cout << res; return 0; } else {... |
#include <bits/stdc++.h> using namespace std; int n, k, l[50 + 1]; void Answer() { int j = 1, s = n; for (int i = 1; i <= k; i++) { if (i > s) s += n - (++j) + 1; cout << j << ; for (int u = n - 1; u > n - j; u--) cout << l[u] << ; cout << l[s - i] << endl; } } int ma... |
// Copyright (c) 2000-2012 Bluespec, Inc.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, pub... |
module FSM(reset,clk,enable,count18,count32,reset_int,done, en_bclk);
input wire reset;
input wire clk;
input wire enable;
input wire count18;
input wire count32;
output reg reset_int;
output reg done;
output reg en_bclk;
localparam e_reset = 2'b00;
localparam e_espera = 2'b01;
localparam e_leer =... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: adc_data_fifo.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// =====================================... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:102400000,102400000 ) using namespace std; int lowbit(int x) { return (x & -x); } template <class T_> T_ f_abs(T_ x) { return x < 0 ? -x : x; } template <class T_> T_ f_max(T_ a, T_ b) { return a > b ? a : b; } template <class T_> T_... |
/**
* 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... |
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=10000 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" clk1_divide_by=5000 clk1_duty_cycle=50 clk1_multiply_by=1 clk1_phase_shift="0" compensate_clock="CLK1" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_d... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; if (n & (n - 1)) { cout << NO << n ; } else { cout << YES << n ; } return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// (c) Copyright 1995-2014 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 int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; const long long linf = 4000000000000000000LL; const long long inf = 998244353; const long double pi = 3.1415926535; void pv(vector<int> a) { for (auto& x : a) cout << x << ; cout << n ; } v... |
#include <bits/stdc++.h> long long p[2750131 + 5]; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) { cin >> a[i]; } long long left = 0, right = n - 1, pas... |
/**
* 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 M = 1e10; set<long long> s; void bt(long long x) { if (x >= M) return; s.insert(x); bt(x * 10 + 4); bt(x * 10 + 7); } int main() { bt(0); int l, r; cin >> l >> r; long long c = 0; for (set<long long>::iterator ... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; const double pi = acos(-1); void print() { cout << n ; } template <typename T, typename... Params> void print(const T& var1, const Params&... var2) { cout << var1 << ; print(var2...); } template <typename T> ... |
#include <bits/stdc++.h> int n, g, c[6010]; bool p(int x) { if (x == 1) return 0; for (int i = 2; i * i <= x; i++) if (x % i == 0) return 0; return 1; } int main() { scanf( %d , &n); g = n * (n + 1) / 2; if ((g & 1) && (n > 2) && !p(g - 2)) c[3] = 2, g -= 3; for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; #pragma optimize( -O3 ) string to_string(string s) { return + s + ; } string to_string(const char* s) { return to_string((string)s); } string to_string(const bool& b) { return (b ? true : false ); } template <typename A, typename B> string to_string(... |
/**
* 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; struct ans { int s, t; }; const int nmax = 100006; int n, v[nmax], s1[nmax], s2[nmax], rasp, acts, fp1[nmax], fp2[nmax]; ans vrasp[nmax]; bool ver; int compar(ans a, ans b) { if (a.t != b.t) return a.t < b.t; else return a.s < b.s; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:06:48 04/28/2015
// Design Name:
// Module Name: BlackInner
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int m, long long int n) { if (n == 0) return m; return gcd(n, m % n); } int MOD = 1000000000; long long int powmod(long long int a, long long int b) { if (b == 0) return 1; long long int x = powmod(a, b / 2); long lo... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:11:12 05/19/2015
// Design Name: top
// Module Name: E:/mips_pipeline/code/test_top.v
// Project Name: mips_pipeline
// Target Device:
// Tool versio... |
#include <bits/stdc++.h> using namespace std; int main() { int n, mx = 0, i, j, value; cin >> n; vector<int> v(n + 1, 0); for (i = 1; i <= n; i++) { cin >> v[i]; v[i] += v[i - 1]; } for (i = 1; i <= n; i++) { for (j = 0; j < i; j++) { if ((v[i] - v[j]) > (100 * (i -... |
#include <bits/stdc++.h> bool office[25][25]; size_t m, n; bool check(size_t x1, size_t y1, size_t x2, size_t y2) { for (size_t x = x1; x <= x2; ++x) { for (size_t y = y1; y <= y2; ++y) { if (office[x][y]) { return false; } } } return true; } bool check(size_t... |
#include <bits/stdc++.h> using namespace std; int t, k; int a, b; int dp[100005]; int sum[100005]; int main() { scanf( %d%d , &t, &k); for (int i = 1; i <= k - 1; i++) { dp[i] = 1; } dp[k] = 2; for (int i = k + 1; i <= 100000; i++) { dp[i] = (dp[i - 1] + dp[i - k]) % 10000000... |
#include <bits/stdc++.h> using namespace std; int n, x, y; set<pair<int, int> > S, T; int solve(set<pair<int, int> >& s, set<pair<int, int> >& t) { set<pair<int, int> >::iterator it1, it2, it3, it4; it1 = s.begin(); it2 = s.end(); it2--; it3 = t.begin(); it4 = t.end(); it4--; whi... |
module testbench();
reg [6:0] in_val; //7 bit
reg tb_clk;
wire [31:0] ADDER;
note2dds dds_adder(tb_clk, in_val, ADDER);
// note div 12 ( * 0,08333333333333333333333333333333)
//; Add input / 16 to accumulator >>> 4
//; Add input / 64 to accumulator >>> 6
//; Add input / 256 to accumulator >>> 8
//; Add input / 102... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 10; const double pi = acos(-1.0); const double eps = 1e-8; struct node1 { int y, x1, x2; } a[5050]; int tp1; struct node2 { int x, y1, y2; } b[5050]; int tp2; bitset<5050> bs[5050]; int main() { int n; tp1 = tp2 ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int maxSize = 1 << 16; map<string, int> t; int a[maxSize]; vector<string> s; vector<vector<int> > v; int main() { int n, k; scanf( %d%d , &n, &k); v.resize(n); s.resize(n); for (int i = 0; i < n; i++) ... |
//
//
//
//
`define NM1 32'd466 //bB_freq
`define NM2 32'd523 //C_freq
`define NM3 32'd587 //D_freq
`define NM4 32'd622 //bE_freq
`define NM5 32'd698 //F_freq
`define NM6 32'd784 //G_freq
`define NM7 32'd880 //A_freq
`define NM0 32'd20000 //slience (over freq.)
module Music (
input [7:0] ibeatNum,
input clk,
outp... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); long long TC = 1; cin >> TC; while (TC--) { int n, f = 1, c = 0; cin >> n; int a[n], feq[110] = {0}; for (int i = 0; i < n; i++) { cin >> a[i]; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, ans = 0, i, temp; vector<int> a; cin >> n; for (i = 0; i < n; i++) { cin >> temp; a.push_back(temp); } sort(a.begin(), a.end()); for (i = 0; i < n; i = i + 2) { if (a... |
//
// 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... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Mark_Extract_Bits.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -----------------------------------------------------------... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; const int N = 5005, P = 1e9 + 7; int ad(int k1, int k2) { return k1 += k2 - P, k1 += k1 >> 31 & P; } int su(int k1, int k2) { return k1 -= k2, k1 += k1 >> 31 & P; } int mu(int k1, int k2) { return 1LL * k1 * k2 % P; } void uad(int& k1, int k2) { k1 += k2 - P, k1... |
#include <bits/stdc++.h> using namespace std; const int N = 100050; struct node { int sa, ea, sb, eb; } a[N]; int t[N << 1], rt1[N << 1], rt2[N << 1], lc[N * 80], rc[N * 80], tot, n, m1, m2; bool cnt[N * 80], addv[N * 80]; inline bool cmp1(const node &a, const node &b) { return a.ea < b.ea; } inline... |
/*******************************************************************
Company: UNSW
Original Author: Lingkan Gong
Project Name: XDRS
Create Date: 19/09/2010
Design Name: intern_sync
*******************************************************************/
`timescale 1ns/1ns
module intern_sync
(... |
#include <bits/stdc++.h> using namespace std; long long n, m, aid = 1, did = 1, atk[105], def[105], c[105]; char s[10]; int main() { cin >> n >> m; for (long long i = 1; i <= n; i++) { scanf( %s , s); if (s[0] == A ) scanf( %lld , &atk[aid++]); else scanf( %lld , &def[... |
#include <bits/stdc++.h> using namespace std; long long n, m; long long getans(long long n) { if (n == 1) return 3 % m; long long k = getans(n / 2); k *= k; if (n % 2) k *= 3; return k % m; } int main() { while (~scanf( %I64d%I64d , &n, &m)) { long long ans = getans(n) - 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; auto n = 19; auto t = 1; while (true) { auto temp = n; auto sum = 0; while (temp > 0) { auto a = temp % 10; temp = temp / 10; sum = sum + a; } if (sum == 10) { ... |
#include <bits/stdc++.h> using namespace std; int power(int a, int b, int c) { long long x = 1, y = a; while (b > 0) { if (b % 2 == 1) { x = (x * y) % c; } y = (y * y) % c; b /= 2; } return x % c; } long long int gcd(long long int a, long long int b) { if (b =... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_sync_flops.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; ifstream fin( AAtest.in.txt ); long long n, p, t[4][ T ], su; string s; int main() { ios::sync_with_stdio(0); cin >> n; for (int(i) = (0); ((i)) < ((n)); ((i))++) { cin >> s; p = s.size(); p--; t[p][s[p]]++; su++; } ... |
/*
*******************************************************************************
* File Name : ada_iaif_stage.v
* Project : ADA processor
* Version : 0.1
* Date : Aug 8th, 2014
* Author : Angel Terrones <>
*
* Disclaimer : Copyright © 2014 Angel Terrones
* ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, ans = -1; cin >> n; pair<int, int> g[n]; for (i = 0; i < n; i++) { cin >> g[i].first >> g[i].second; } sort(g, g + n); for (i = 0; i < n; i++) { if (ans <= g[i].second) ans = g[i].second; else ... |
/***************************************************************************************************
* *
* Module: Altera_UP_PS2_Command_Out *
* Description: *
* This module send... |
#include <bits/stdc++.h> using namespace std; const int N = 2005, mod = 998244353; int n, a[N][N], f[N][N], jie[N], ans, vis1[N], vis2[N], c[N], c2[N], vis3[N]; inline int qpow(int a, int b, int res = 1) { for (; b; b >>= 1, a = 1ll * a * a % mod) if (b & 1) res = 1ll * res * a % mod; return res; ... |
#include <bits/stdc++.h> using namespace std; int K, N; long double XX, YY, P[101], PP, arr[101][101], obj[101][2], EPS = 1e-9; double calk(int n, int k) { if (arr[n][k] != -1) return arr[n][k]; double retAns = 0; if (n == 1 && k == 1) arr[n][k] = P[1]; else if (n == 1 && k == 0) arr... |
//Test Bench for Multiplier Functional Unit
module MultiplierTB;
reg clk, reset;
wire [15:0] result;
reg [7:0] x, y;
wire ready;
//Data containing 0
reg [7:0] test0Data = 8'b00000000;
//Data containing 1
reg [7:0] test1Data = 8'b00000001;
//Data for testing left and right multiplication with iden... |
#include <bits/stdc++.h> using namespace std; const int maxN = (int)1e6 + 10; int mod = (int)1e9 + 7; int sum(int a, int b) { int s = a + b; if (s >= mod) s -= mod; return s; } int n; int mult(int a, int b) { return (1LL * a * b) % mod; } int a[maxN]; int inv[maxN]; int fact; void calc... |
/*
* 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 int MAXN = 2e6 + 1; const int INF = 2e9 + 1; const int MOD = (1e9 + 7); void bye(string s = ) { cout << s << n ; exit(0); } signed main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; cin >> t; ... |
#include <bits/stdc++.h> const double PI = 3.1415926; const int KL = 1e6; using namespace std; long long q, x, y, z, n, m, p[KL], mn = 1e9, mx = -1e9, ans; string t; vector<int> vec[KL]; set<int> s; map<int, int> M; int pr[KL], sz[KL]; int prfind(int node) { if (pr[node] == node) return no... |
#include <bits/stdc++.h> using namespace std; unsigned int dp[100100]; char s[100100]; int main() { unsigned int n; cin >> n; if (n & 1) { return !printf( 0 ); } scanf( %s , s + 1); int m = n / 2; dp[0] = 1; for (int i = 1; i <= n; i++) { if (s[i] == ? ) { fo... |
(* Copyright (c) 2008-2012, Adam Chlipala
*
* This work is licensed under a
* Three-clause BSD Licence
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source ... |
#include <bits/stdc++.h> using namespace std; int FASTBUFFER; const int N = 1005; const int INF = 1000000000; char str[N][N]; int n, m, l[N], r[N]; int main() { scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %s , str[i] + 1); } for (int i = 1; i <= n; i++) { int ... |
/**
* 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... |
parameter DW = 16;
parameter AW = 8;
module pllclk (input ext_clock, output pll_clock, input nrst, output lock);
wire dummy_out;
wire bypass, lock1;
assign bypass = 1'b0;
// DIVR=0 DIVF=71 DIVQ=3 freq=12/1*72/8 = 108 MHz
SB_PLL40_CORE #(.FEEDBACK_PATH("SIMPLE"), .PLLOUT_SELECT("GENCLK"),
.DIVR(4... |
// ==============================================================
// 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... |
#include <bits/stdc++.h> using namespace std; int n, ans, k, d, cnt1, cnt2, l, r; int a[200050]; struct node { int x, b; }; node s[200050]; int main() { k = 1; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); } l = 1, r = n, s[0].x = 0; d = 0; while... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int up, down; int people = 0; int max = 0; cin >> n; while (n--) { cin >> up >> down; people = people - up + down; if (people > max) max = people; } cout << max << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; char a[15]; char rr[15]; char ans[15]; int main() { int maxx = -99; cin >> a; int len = strlen(a); for (int i = 1; i < 1 << len; i++) { int cnt = 0; for (int j = 0; j <= len - 1; j++) { if (i >> j & 1) rr[++cnt] = a[j]; } ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long dx[] = {-1, 0, 1, 0}; long long dy[] = {0, -1, 0, 1}; vector<long long> v(10); string s; set<string> st; void call(string s, long long pos) { if (pos == 10) { sort(s.begin(), s.end()); st.insert(s); ... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
/*
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
// counters
int cnt;
int cnt_bit ;
int cnt_byte;
int cnt_int ;
int cnt_ar1d;
... |
#include <bits/stdc++.h> using namespace std; int n, ans[16]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; if (!(n & 1)) { cout << 0 << n ; return 0; } ans[1] = 1; ans[3] = 18; ans[5] = 1800; ans[7] = 670320; ans[9] = 7... |
//Legal Notice: (C)2013 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; int main(void) { int n, i; scanf( %d , &n); printf( %d , n); for ((i) = 0; (i) < (int)(n - 1); (i)++) printf( %d , i + 1); printf( n ); return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 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 int mod = 1e9 + 7; void solve() { string s; cin >> s; int cntr1 = 10, cntr2 = 10; int wt1 = 0, wt2 = 0; for (int i = 0; i < 10; i++) { if (i % 2 == 0) { if (s[i] == 1 || s[i] == ? ) wt1++; } else { if ... |
#include <bits/stdc++.h> using namespace std; struct node { int y, ne; } e[200010]; int f[100005], h[100005], np, vis[100005], s; long long dp[100005], r[100005]; long long saya(int n) { if (dp[n] != -1) return dp[n]; vis[n] = 1; long long ans = 0, res = 0; vector<long long> v; for (... |
//==============================================================================
// File: $URL: svn+ssh:///public/Projects/GateLib/branches/dev/Firmware/UART/Hardware/UAReceiver.v $
// Version: $Revision: 26904 $
// Author: Greg Gibeling (http://www.gdgib.com)
// Copyright: Copyright 2003-2010 UC Berkeley
//=========... |
#include <bits/stdc++.h> using namespace std; struct rua { long double x, y; } m; set<pair<long double, long double> > p; vector<pair<long double, long double> > del; vector<long double> d; set<long double> mm; int n, ans; long double x, y; bool tt; bool check(rua T) { d.clear(); rua M... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T gcd(T a, T b) { if (b == 0) return a; ... |
#include <bits/stdc++.h> using namespace std; int sqr(int v) { return v * v; } int main() { int x1, y1, x2, y2, r1, r2; cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2; if (r1 < r2) swap(x1, x2), swap(y1, y2), swap(r1, r2); int t1 = sqr(x1 - x2) + sqr(y1 - y2); long double ans(0); if (t1 < sqr(r1 ... |
// IS61LV25616 Asynchronous SRAM, 256K x 16 = 4M; speed: 10ns.
// Note; 1) Please include "+define+ OEb" in running script if you want to check
// timing in the case of OE_ being set.
// 2) Please specify access time by defining tAC_10 or tAC_12.
`define OEb
`define tAC_10 //tAC_10 or tAC_12 defines... |
#include <bits/stdc++.h> using namespace std; struct bign { int len, s[109]; bign() { memset(s, 0, sizeof(s)); len = 1; } bign(int num) { *this = num; } bign(const char *num) { *this = num; } bign operator=(const int num) { char s[109]; sprintf(s, %d , num); *t... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5, mod = 1e9 + 7; int a[N], st[N][20], pos[N][20]; int seg_query(int l, int r) { int k = log2(r - l + 1); if (st[l][k] > st[r - (1 << k) + 1][k]) return pos[l][k]; else return pos[r - (1 << k) + 1][k]; } long long f[N]... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; char s[N]; int a[N], b[N], n; int f[N][2][2]; pair<int, int> g1[N][2][2], g2[N][2][2]; void solve() { for (int l = 0, r = n + 1; l <= r; l++, r--) { if (l + 1 == r || l == r) break; int i = l; for (int j = 0; j < 2;... |
#include <bits/stdc++.h> using namespace std; long long MAX = 1000000000; long long MOD = 1000000007; pair<long long, long long> p[100010]; void solve() { long long n; cin >> n; long long d; cin >> d; ; for (long long i = (0); i < (n); i++) { long long in1; cin >> in1; ... |
#include <bits/stdc++.h> using namespace std; bool sortp(const pair<int, int> a, const pair<int, int> b) { if (a.first > b.first) return 0; else if (a.first < b.first) return 1; else return a.second > b.second; } int main() { int n, m; cin >> n >> m; pair<int, int> b; ... |
#include <bits/stdc++.h> using namespace std; char a[105]; char temp[105]; int main() { int n; scanf( %d%*c , &n); while (n--) { int cnt = 0; bool flag = false; bool first = false; gets(a); int len = strlen(a); for (int i = len - 5; i <= len; i++) temp[cnt++] = a[... |
/**
* 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 "async_receiver.v"
`include "async_transmitter.v"
// by teknohog, replaces virtual_wire by rs232
module serial_receive(clk, RxD, midstate, data2);
input clk;
input RxD;
wire RxD_data_ready;
wire [7:0] RxD_data;
async_receiver deserializer(.clk(clk), .RxD(RxD), .RxD_data_re... |
#include <bits/stdc++.h> using namespace std; int n, a[1000005], r[3], cnt; bool up, down; set<int> s; int main() { srand(75435); scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); if (n <= 2) { cout << -1; return 0; } for (int i = 0; i < n; i++) { if (s... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.