text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int n, ys, ans; int main() { cin >> n; ys = 0; ans = 0; for (int i = n; i > 0; i /= 8) { ys = i % 8; if (ys == 1) ans++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 500000; const long long minx = -0x5fffffffffffffff; struct nn { long long x, y; nn() { y = minx; } }; int n, u, v; nn num[N]; vector<int> node[N]; long long dfs(int f, int x) { for (int i = 0; i < node[x].size(); i++) { if (...
// (C) 2001-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
/* * Copyright (C) 2011 Kiel Friedt * * 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 p...
#include <bits/stdc++.h> using namespace std; void task(); int main() { srand(time(0)); task(); return 0; } const int INF = 0x3f3f3f3f; const int N = 1e6 + 10; const int M = 1e7 + 100; const int OLOLO = 0xFFFFFFFF; int n, k; long long int cnt[N]; set<int> vals; long long int ans; v...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 6 * n * (n - 1) + 1; return 0; }
#include <bits/stdc++.h> using namespace std; int k, n, maxb, t; int b[100010], flag[100010]; int main() { ios::sync_with_stdio(false); cin >> k >> n >> maxb >> t; t = min(t, min(n, maxb)); for (int ti = 1; ti <= k; ti++) { for (int i = 1; i <= n; i++) cin >> b[i]; for (int i = 0; i ...
/* * integer3gt - a verilog test for integer greater-than conditional > * * Copyright (C) 1999 Stephen G. Tell * Portions inspired by qmark.v by Steven Wilson () * * 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 ...
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; const int mod = 1e9 + 7; const int inf = 2e9 + 5; const int N = 501; int n, m, a[N][N], b[N]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n >> m; ...
// (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...
// $Id: c_gate_bits.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: Redistributions ...
#include <bits/stdc++.h> using namespace std; string s; int n; int a[26]; int b[26]; bool flag[26]; bool cmp(int x, int y) { return a[x] < a[y]; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> s >> n; memset(a, 0, sizeof(a)); memset(flag, 1, sizeof(flag));...
/** * 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 inf = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int maxn = 3e5 + 10; const int maxv = 1e3 + 10; const double eps = 1e-9; std::vector<int> G[maxn]; int ans[maxn]; void inv(int i) { ans[i] ^= 1; } bool bad(int u) { int cnt = 0; for (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...
#include <bits/stdc++.h> using namespace std; int n, ans = 1, res = 1, x, mn = 0, mx = 1e9; set<int> S; set<int>::iterator it; char s[10]; int main() { scanf( %d , &n); S.insert(1e9), S.insert(0); for (int i = 1; i <= n; ++i) { scanf( %s%d , s, &x); if (s[1] == D ) S.insert(...
#include <bits/stdc++.h> using namespace std; const int MN = 1e5 + 5; int T, N, arr[MN]; void solve() { scanf( %d , &N); for (int i = 0; i < N; i++) scanf( %d , arr + i); sort(arr, arr + N); printf( %d n , min(min(arr[N - 1], arr[N - 2]) - 1, N - 2)); } int main() { scanf( %d , &T); ...
#include <bits/stdc++.h> int check(int num1, int num2); using namespace std; int main() { int k, l, m, n, d; cin >> k; cin >> l; cin >> m; cin >> n; cin >> d; int total = 0; for (int i = 1; i < d + 1; i++) { if (check(i, k) || check(i, l) || check(i, m) || check(i, n)) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:41:33 10/30/2014 // Design Name: // Module Name: UART_loop // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
//---------------------------------------------------------------------------- // // COPYRIGHT (C) 2011, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTR...
// ============================================================================= // COPYRIGHT NOTICE // Copyright 2006 (c) Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // This confidential and proprietary software may be used only as authorised by // a licensing agreement from Latt...
#include <bits/stdc++.h> using namespace std; const int N = 4002; int n = 0, a; char ch[N]; long long ans = 0, sum[N][N], all; long long d[N * 9]; int val(int ind) { return ch[ind - 1] - 0 ; } int main() { cin >> a; while (cin >> ch[n]) n++; for (int i = 1; i <= n; ++i) { for (int j =...
/** * 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; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using ld = long double; const int MN = 5e5 + 5, MM = 1e6 + 3; vector<int> bs; struct Lady { int a, b, c; } ladies[MN]; int bit[MN]; int n; void update(int i, int v) { ...
#include <bits/stdc++.h> using namespace std; int a[200010], b[200010]; bool used[200010]; int main() { int n, k = 0, i, x; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]); for (i = 1; i <= n; i++) scanf( %d , &b[i]); int ans = 1 - accumulate(b + 1, b + n + 1, 0) % 2; for (i...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0; char ch = getchar(); bool f = 0; for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = 1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return f ? -x : x; } void write(long long ...
#include <bits/stdc++.h> using namespace std; int pw(int a, int b) { if (b == 0) return 1; if (b == 1) return a; long long rep = pw(a, b / 2), M = 1e9 + 7; if (b % 2 == 0) return (rep * rep) % M; return (((rep * rep) % M) * a) % M; } int main() { int n, k, m; cin >> n >> m >> k; ...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
#include <bits/stdc++.h> using namespace std; bool vt[202][202]; int cnt, n; int dfs(int x, int y) { int mx1 = 0, mx2 = 0, mx = 0; for (int i = 1; i <= n; i++) if (vt[x][i] && i != y) { mx = max(mx, dfs(i, x)); if (cnt > mx1) mx2 = mx1, mx1 = cnt; else if (cnt > m...
#include <bits/stdc++.h> using namespace std; int main() { int tu[200], a[200]; int f[200]; int n, m, k; int min; int i, j; scanf( %d %d %d , &n, &m, &k); for (i = 0; i < m; i++) { scanf( %d , &f[i]); a[i] = 0; } for (i = 0; i < k; i++) scanf( %d , &tu[i]); for (i...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int current = 1, maxtotal = 0; for (int i = 0; i < n; i++) { current = 1; for (int j = i; j < n - 1 && a[j] >= a[j + 1]; j++, current++) ...
#include <bits/stdc++.h> using namespace std; int main() { string s, s1; int count1 = 0, count2 = 0; cin >> s >> s1; for (int i = 0; i < s.size(); i++) { if (s[i] != s1[i]) { if (s[i] == 4 ) count1++; else count2++; } } if (count1 <= count2) ...
`timescale 1ns / 1ps module uart_rx( input CLK, input RST, input EN, input RX, input ISFULL, output WRITE, output [DATAWIDTH - 1 : 0] DATA ); parameter DATAWIDTH = 8; p...
#include <bits/stdc++.h> using namespace std; long long n; string s; long long cnt[10]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; cin >> s; for (long long(i) = (0); (i) <= (n - 1); (i)++) cnt[s[i] - 0 ]++; cout << min(n / 11, cnt[8]) << endl; return 0; }
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); char arr[n + 1]; scanf( %s , arr); int ans[26]; for (int m = 0; m < 26; m++) ans[m] = 0; for (int j = 0; j < n; j++) { int k = arr[j]; if (k > 64 && k < 91) ans[k - 65] = 1; else ans[k - 97] = 1...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long MOD = 1e9 + 7; const long long mod = 998244353; const long long mxN = 1e6; void fileio() {} vector<long long> v[mxN]; vector<long long> vis(mxN); long long nd; void dfs(long long x, long long p) { vis[x] = ...
// (c) Copyright 1995-2016 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 ...
/* * 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(void) { int n, k; cin >> n >> k; int r[257] = {}; for (int i = 0; i < 257; i++) { r[i] = -1; } int p; for (int i = 0; i < n; i++) { cin >> p; if (r[p] == -1) { for (int j = (p - k + 1 >= 0) ? p - k + 1 : 0; ...
#include <bits/stdc++.h> using namespace std; const int N = 300020; inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch > 9 || ch < 0 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = s * 10 + ch - 0 , ch = getchar(); return s ...
/* * Copyright (c) 1999 Daniel Nelsen () * * 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 lat...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 100 + 3, inf = 1000 * 1000 * 100; int n, m, a[MAXN], b[MAXN], t[MAXN], ans = 0, y, z; int main() { cin >> n >> m >> y >> z; for (int i = 0; i < n; i++) cin >> a[i]; b[0] = -inf; b[m + 1] = inf; for (int i = 1; i <= m; i++)...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__) #else #define DEBUG(...) 6 #endif template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << ( << p.first << , << p.second << ) ;} templa...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e18 + 7; void solve() { int n, k; cin >> n >> k; string s; cin >> s; for (int i = 0; i < k; i++) { int z = 0, one = 0, j = i + k; for (j; j < n; j += k) { if (s[j] == 1 ) one++;...
#include <bits/stdc++.h> using namespace std; long long int seg[800005], lazy[800005]; void push(long long int v) { if (lazy[v] == 0) return; seg[2 * v] |= lazy[v]; seg[2 * v + 1] |= lazy[v]; lazy[2 * v] = lazy[v]; lazy[2 * v + 1] = lazy[v]; lazy[v] = 0; return; } void update(long ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; string str; getline(cin, str); bool isok = true; for (int i = 0; i < n; i++) { getline(cin, str); int x = 0; for (int j = 0; j < st...
#include <bits/stdc++.h> using namespace std; const double pi = 4 * atan(1); int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, int b) { return a / gcd(a, b) * b; } const int LEN = 330; int main() { long long x1, y1, x2, y2; long long n; long long arr[LEN][3]; long l...
#include <bits/stdc++.h> using namespace std; const int N = 2010; char mp[N][N]; int n, m, cnt1, cnt2, in[N][N]; int xx[6] = {0, 0, 1, 0, -1}; int yy[6] = {0, 1, 0, -1, 0}; queue<pair<long long, long long> > q; int main() { int n, m; while (cin >> n >> m) { memset(in, 0, sizeof in); ...
#include <bits/stdc++.h> using namespace std; int main() { float n, k, y, s, per; cin >> n >> k >> y; per = (n * y) / 100; s = per - (int)per; if (s != 0) per = (int)per + 1; if ((per - k) > 0) { cout << per - k; } else { cout << 0 ; } }
/***************************************************************************** ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2012, Aeroflex Gaisler -- -- This ...
#include <bits/stdc++.h> using namespace std; int n, m, k, arr[1005][1005]; void ch_col(int x, int y) { for (int i = 1; i <= n; i++) swap(arr[i][x], arr[i][y]); } void ch_row(int x, int y) { for (int i = 1; i <= m; i++) swap(arr[x][i], arr[y][i]); } int row[1005], col[1005]; int main() { for...
/*mjytxdy!*/ #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define all(x) x.begin(),x.end() #define SZ(x) ((int)x.size()) #define pii pair<int,int> #define pil pair<int,ll> #define pli pair<ll,int> #define pll pair<ll,ll> #define inl inline...
#include <bits/stdc++.h> using namespace std; vector<int> a; void SieveOfEratosthenes(int n) { bool prime[n + 1]; memset(prime, true, sizeof(prime)); for (int p = 2; p * p <= n; p++) { if (prime[p] == true) { for (int i = p * p; i <= n; i += p) prime[i] = false; } } for (in...
#include <bits/stdc++.h> using namespace std; bool rev[35]; int main() { int n, m; cin >> m >> n; for (int i = 0; i < n; i++) { printf( 1 n ); fflush(stdout); int x; scanf( %d , &x); if (x == 0) return 0; if (x < 0) rev[i] = true; else rev[i] =...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; void makedata() { freopen( input.txt , w , stdout); fclose(stdout); } long long a[250000]; int n, q; template <typename T> class SegmentTree { private: T *data, *lazy; int type; vo...
/** * This is written by Zhiyang Ong * for EE577b Homework 4, Question 3 */ // Behavioral model for the SIPO convertor module SIPO(data_out, out_valid, serial_in, in_valid, reset_b, clk); // Output signals representing the end of the transaction // Output of the SIPO convertor output [7:0] data_out; /** * ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if ((n - 2) % 3 != 0) cout << 1 << 1 << n - 2; else cout << 1 << 2 << n - 3; }
#include <bits/stdc++.h> using namespace std; vector<int> Arr; int main() { int N, K; cin >> N >> K; int Num, Acum; int i, j; for (i = 0; i < N; i++) { cin >> Num; Arr.push_back(Num); } sort(Arr.begin(), Arr.end()); j = 0; Acum = 0; for (i = 0; i < K; i++) { ...
#include <bits/stdc++.h> using namespace std; long long N, a[100010], s[100100], cnt[100010]; void update(long long *t, long long pos, long long val) { for (; pos <= N; pos += pos & (-pos)) t[pos] += val; } long long query(long long *t, long long r) { long long res = 0; for (; r > 0; r -= r & (-r)...
#include <bits/stdc++.h> using namespace std; pair<long double, pair<long long, long long> > c[250001]; long double p, q, abcd, ABCD; long long a, b, n, i, x, y; bool comp(pair<long double, pair<long long, long long> > a, pair<long double, pair<long long, long long> > b) { if (a.first < b.firs...
#include <bits/stdc++.h> #pragma warning(disable : 4996) FILE *in = stdin, *out = stdout; using namespace std; int n, ans[100005], N; int alpha[30]; char a[2005], b[2005], c[2005]; void input() { fscanf(in, %d , &n); fscanf(in, %s , &a[1]); fscanf(in, %s , &b[1]); } int most_fit(int sta...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const long double PI = 3.141592653589793238462643383279502884197; long long fac[1] = {1}, inv[1] = {1}; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long mp(long long a, long long b) { long long ret ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are...
#include <bits/stdc++.h> using namespace std; using lli = long long int; using pii = pair<int, int>; using vi = vector<int>; using vb = vector<bool>; using vvi = vector<vector<int>>; using vlli = vector<long long int>; using vpii = vector<pair<int, int>>; const int N = 200005; const int blockSize = ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 3; long long int x[maxn], y[maxn]; long long int w[maxn]; int ct[maxn]; vector<int> v[maxn]; int ans[maxn]; int done_per[maxn]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> w[i]; } ...
// 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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int a, b, n, s; cin >> a >> b >> n >> s; long long int r = s % n; long long int q = s / n; if (q <= a) { ...
#include <bits/stdc++.h> using namespace std; pair<pair<int, int>, pair<int, int> > a[60000]; int ans[60000], b[60000], n, m, maxx; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) cin >> a[i].first.first >> a[i].first.second >> a[i].second.first >> a[i].second.second; for (i...
#include <bits/stdc++.h> using namespace std; const int N = 1000006, B = 1000001969; int n, k, m, L[N], R[N]; char a[N], b[N]; long long a1[N], M[N]; set<int> Set; int actual(int x) { auto it = Set.lower_bound(x); return it == Set.end() ? n + 1 : *it; } void hash_build(char a[], int n, long lo...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; vector<int> g[maxn]; int src[maxn], dest[maxn]; bool vis[maxn]; int main() { int n, m; int a, b; scanf( %d %d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d %d , &a, &b); a--, b--; g[a].push_back(b);...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; const int inf = 1e9; int arr[N], pos[N], rMax[N]; int main() { int n, m; scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , arr + i); pos[arr[i]] = i; } fill(rMax, rMax + N, n - 1); while (...
#include <bits/stdc++.h> using namespace std; template <typename T> T sqr(T x) { return x * x; } template <typename T> T abs(T x) { return x < 0 ? -x : x; } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } const int MAXN = 1e5 + 10; int n; int sum = 0; pair...
#include <bits/stdc++.h> using namespace std; const int sz = 4e6 + 50; int n, m; string str; int s[sz], e[sz], four[sz], seven[sz], non_dec[sz], non_inc[sz]; vector<bool> lazy(sz, 0); void calculate(int node) { int lc = node * 2; int rc = lc + 1; int f1 = four[lc], s1 = seven[lc], nd1 = non_de...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; char a[65]; void pre() { int j = 1; for (j = 1; j <= 10; j++) a[j - 1] = (char)(j - 1 + 48); for (int i = 0; i < 26; i++) a[j++] = (char)(i + 97); for (int i = 0; i < 26; i++) a[j++] = (char)(i + 65); a[10] = Z ; } 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...
/* Filename : UART.v Compiler : Quartus II Description : UART TX Send Data and RX Receive Data Modules : UART_TX...input clk; //系统时钟 input rst; input [7:0]DATA; //发送数据 input EN; //使能信号 output reg TX; ...
#include <bits/stdc++.h> using namespace std; int main() { size_t n; string s, t; cin >> n >> s >> t; int base = ( z - a ) + 1; vector<int> l(n + 1), r(n + 1); for (int i = 0; i < int(n); ++i) { l[i + 1] = s[i] - a ; } for (int i = 0; i < int(n); ++i) { r[i + 1] = t[i]...
#include <bits/stdc++.h> using namespace std; const int N = 300 * 1000 + 5, SQ = 373; int a[N]; long long dp[2 * N]; pair<pair<int, int>, int> t[N]; long long finans[N]; int main() { ios ::sync_with_stdio(false); int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[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...
/** * 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...
/*************************************************************************************************** ** fpga_nes/hw/src/cpu/apu/apu_div.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 th...
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 1; int a[N]; int main() { float n, x, y; cin >> x >> y; printf( %.12f , (y * y - x * x) / (2 * x)); }
//================================================================================================== // Filename : tb_CORDIC_Arch3.v // Created On : 2016-10-03 23:39:40 // Last Modified : 2016-10-05 14:22:11 // Revision : // Author : Jorge Sequeira Rojas // Company : Instituto Tecnologic...
(* -*- coding: utf-8 -*- *) (************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* <O___,, * (see CREDITS file for the list of authors) ...
// Memory-WriteBack Pipeline Register module wb_pipe_reg ( input wire clk, input wire reset, input wire valid_wb_pipe_reg_i, input wire reg_wr_wb_pipe_reg_i, input wire mem_to_reg_wb_pipe_reg_i, input wire[4:0] rd_wb_p...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:10:59 06/07/2015 // Design Name: UART_LOOPBACK // Module Name: /home/sadique/Work/Verilog/Spartan6/USB-uart/loopbacktest.v // Project Name: USB-uart // Target Dev...
#include <bits/stdc++.h> using namespace std; const int MAXN = 3030; struct dsu { int par[MAXN]; void clear() { for (int i = 0; i < MAXN; ++i) par[i] = i; } int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); } bool join(int u, int v) { if ((u = find(u)) == (v = find(...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int N, M; cin >> N >> M; using Interval = pair<int, int>; vector<Interval> intervals(N); for (int i = 0; i < N; i++) { cin >> intervals[i].first >> intervals[i].second; } int i = 0; ...
#include <bits/stdc++.h> const int t = 50; int f[t][t][t], g[t][t]; long long p[t]; int cnt; void mul(int c[t][t], int a[t][t], int b[t][t], int n) { int d[t][t]; memset(d, 0, sizeof d); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) for (int k = 0; k < n; k++) d[i][k] ^= a[...
//------------------------------------------------------------------------------ // YF32 -- A small SOC implementation based on mlite (32-bit RISC CPU) // @Taiwan //------------------------------------------------------------------------------ //...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2014 by Wilson Snyder. // bug823 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data and app...
#include <bits/stdc++.h> using namespace std; struct vertex { long long inside, edge; int size = 1; vector<int> child; }; int ans = 0; multiset<long long> st; vertex g[100009]; void dfs(int v, bool flag, long long deep) { if (flag) { for (int i = 0; i < g[v].child.size(); i++) { ...
#include <bits/stdc++.h> int main(int argc, char *argv[]) { int a1, a2, a3, x; scanf( %d%d%d , &a1, &a2, &a3); x = a2; --a3; while (a3--) { x = a1 + a2; a1 = a2; a2 = x; } printf( %d n , x); return 0; }
#include <bits/stdc++.h> using namespace std; int n; int a, b; vector<int> arr; vector<vector<int> > dp; void solve1(string x, int a, int b) { int n = x.length(); int l = n + 1; int r = -1; for (int i = 0; i < n; i++) { if (x[i] == 1 ) { l = min(l, i); r = max(r, i); ...
// megafunction wizard: %LPM_MULT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_mult // ============================================================ // File Name: acl_int_mult64s.v // Megafunction Name(s): // lpm_mult // // Simulation Library Files(s): // lpm // =====================================...
#include <bits/stdc++.h> using namespace std; template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; } template <class T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; } inline int nxt() { int wow; scanf( %d , &wow); return wo...
#include <bits/stdc++.h> using namespace std; int arr[101][1001]; int n, m; int g[101][101]; vector<int> col[1001]; set<int> row[101]; bool ans[101][101]; int main() { scanf( %d , &n), scanf( %d , &m); for (int i = 0; i < m; ++i) { int x, y; scanf( %d , &x), scanf( %d , &y); g[...
module test(); typedef struct packed { logic [31:0] sub_local; } row_entry_t; typedef struct packed { logic [31:0] row_local; row_entry_t sub; row_entry_t [1:0] sub_list; } row_t; row_t main; initial begin main.row_local = 32'hCAFE; ...
#include <bits/stdc++.h> using namespace std; int n, st, dr, mij, r, l12, l11, c12, c11; int l21, l22, c21, c22; int nr; void getldrept(int li, int ls, int ci, int cs) { int st, dr; int l1, c1, l2, c2; st = li; dr = ls; while (st < dr) { mij = (st + dr) / 2; cout << ? << li ...
/** * 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...