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...
/** * 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 n, i, j, r; char lvl[110]; scanf( %d , &n); scanf( %s , lvl); for (r = 1; r < n; r++) { for (i = 0; i < n; i++) { for (j = 0; j <= 4; j++) { if (i + j * r >= n || lvl[i + j * r] != * ) break; } if (j >= 5) { ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long N = 2e5 + 7; const int mod = 1e9 + 7; bool cmp(const pair<long long, long long>& a, const pair<long long, long long>& b) { return a.first < b.first; } long long median(long long a, long long b, long lo...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int n; map<int, int> a; void reset() { a.clear(); } void input() { cin >> n; int c; for (int(i) = (0); (i) < (n); ++i) { cin >> c; a[c]++; } } bool check(int s) { for (auto it = a.begin(); it != a.end(); ++it) { double b =...
#include <bits/stdc++.h> using namespace std; int main() { int n, d; cin >> n >> d; int t[n], sum = 0, rest = (n - 1) * 10; for (int i = 0; i < n; i++) { cin >> t[i]; sum = sum + t[i]; } if ((rest + sum) > d) { cout << -1 ; return 0; } else { int bal = d - ...
#include <bits/stdc++.h> using namespace std; long long a[300010], po[300010], ans; int n, p = 1e9 + 7; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]); sort(a + 1, a + n + 1); po[0] = 1; for (int i = 1; i <= n; i++) po[i] = po[i - 1] * 2 % p; for (int i ...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, deg[N], fa[N]; int root = 0; vector<pair<pair<int, int>, int> > ans; struct edge { int to, val; edge() {} edge(int to, int val) : to(to), val(val) {} }; vector<edge> G[N]; vector<int> leaf[N]; void add_edge(int x,...
#include <bits/stdc++.h> using namespace std; int a[200000 + 1]; int n; int b[200000 + 1]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; b[a[i]] = 0; } int max = -1; int k = 0; int numb; for (int i = n; i > 0; i--) { k = 0; if (b[a[i]] =...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:14:28 05/18/2015 // Design Name: median5x5 // Module Name: /home/vka/Programming/VHDL/workspace/sysrek/skin_color_segm/tb_median5x5.v // Project Name: vision // T...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long int n, m; cin >> n >> m; long long int a[n], b[m]; long long int aux[n]; for (long long int i = 0; i < n; ++i) { cin >> a[i]; if (i == 0) aux[i] = a[i]; else aux[i] = aux[i - 1] + a[i]; ...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int n = s.length(); int x = t.length(); vector<int> lft(x); vector<int> rgt(x); int l = 0; for (int i = 0; i < n && l < x; ++i) { if (s[i] == t[l]) { lft[l++] = i; } } l...
// -------------------------------------------------------------------- // Virtual JTAG DSKY console // -------------------------------------------------------------------- module vji_dsky( input clk, // main clock input [7:0] data_in, // data input output reg [3:0] sel_out, // select output regist...
#include <bits/stdc++.h> using namespace std; struct node { int sum; int adj[6]; node() { sum = 0; memset(adj, -1, sizeof adj); } }; int n, m; vector<node> T; map<string, int> S; void add(string x) { int cur = 0; for (int i = 0; i < x.size(); i++) { int c = x[i] -...
#include <bits/stdc++.h> using namespace std; struct proc { string name; string var[10]; }; struct vari { string name; string x; }; string s, t, name, varr[10]; proc a[1005]; vari b[1005]; int res, n, m, k, para[1005], p; bool check; int main() { if (0) { freopen( a.inp ,...
module operator( clk, reset_n, synth_ctrl, synth_data, data_out, wreq); input wire clk, reset_n; input wire [7:0] synth_data, synth_ctrl; output wire wreq; output wire [15:0] data_out; wire [15:0] sine_out; wire [20:0] phase; reg [...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ `timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time uni...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:42:42 05/12/2015 // Design Name: // Module Name: inverse_perm // Project Name: // Target Devices: // Tool versions: // Description: // // De...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e7 + 2; const int M = (int)5e5 + 2; const int mod = (int)1e9 + 7; int mu[N], cnt[N]; int n, mx, x, p[M]; long long res; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen( test ...
/* * Copyright (c) 2001 Stephen Williams () * * 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; void DBG() { cerr << ] n ; } template <typename T, typename... Args> void DBG(T first, Args... args) { cerr << first; if (sizeof...(args)) cerr << , ; DBG(args...); } void solve() { long long int x0, y0, ax, ay, bx, by, sx, sy, t; cin >> x...
/** * 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> typedef struct Segment { int start; int last; int Xor; } segment; using namespace std; vector<segment> V; int score(segment s) { if (s.last == s.start) return s.Xor; else { int value = 0; for (int i = s.start + 1; i < s.last;) { if (V[i].s...
//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 associated do...
#include <bits/stdc++.h> using namespace std; long long p[222222]; long long sum[222222]; long long max1[222222]; long long max2[222222]; long long get(long long l, long long r) { long long t = sum[r]; if (l >= 1) { t -= sum[l - 1]; } return t; } int main() { long long n, k; ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time ba...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; char ch = getchar(); while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return x; } const int maxn = 100005; int n; long long zero = 0, one = 0, z1 = 0, o1 = 0; cha...
// A small processor I once created, intended to be used as a debug // processor in ASICs and FPGAs. // // Very limited instruction set, but I never intended to write // many programs for it. // // In an FPGA it would probably be better to use for example // PicoBlaze... // module serial_wb_top( input wire clk_i,...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.1 (lin64) Build Fri Apr 8 15:45:23 MDT 2016 // Date : Mon Jun 6 23:00:46 2016 // Host : edinburgh running 64-bit Ubuntu 15.04 // Co...
`begin_keywords "1364-2005" /* * This tests the synthesis of a case statement that has an empty case. */ module main; reg clk, bit, foo; // Synchronous device that toggles whenever enabled by a high bit. always @(posedge clk) case (bit) 1'b0: ; 1'b1: foo <= ~foo; endcase // case(bit...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int kq = 0; vector<pair<int, int> > res; int n, k; cin >> n >> k; vector<bool> used(2 * n + 1, false); for (int i = 1; i <= k; i...
#include <bits/stdc++.h> using namespace std; void solve(int test_number); int main() { cout.setf(ios::fixed); cout.precision(9); cerr.setf(ios::fixed); cerr.precision(3); int n = 1; for (int i = 0; i < n; i++) { solve(i + 1); } return 0; } const int MAXN = 200100; cons...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel 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 docum...
// // 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...
module chanOffsetMUX ( input clk, input signed [12:0] chanOffset, input [3:0] chanOffsetSel, output reg signed [12:0] chan1_offset = 13'sd0, // program static offsets here! output reg signed [12:0] chan2_offset = 13'sd0, output reg signed [12:0] chan3_offset = 13'sd0, output reg signed [12:0] chan4_offset = 13'...
/* Copyright (c) 2018 Alex Forencich 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, publish, distribute,...
// (C) 2001-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 doc...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:55:21 05/03/2016 // Design Name: // Module Name: data_deal // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
/* ------------------------------------------------------------------------------- * (C)2007 Robert Mullins * Computer Architecture Group, Computer Laboratory * University of Cambridge, UK. * ------------------------------------------------------------------------------- * * Physical-Channel Buffers * ==========...
#include <bits/stdc++.h> using namespace std; int Search[1001][1001], Target1[1001], Target2[1001], Attack = 0; int main() { int Data1, Data2; cin >> Data1 >> Data2; for (int i = 0; i < Data1; i++) { for (int i2 = 0; i2 < Data2; i2++) { char Test; cin >> Test; if (Test ==...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 13 12:47:17 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; long long a, b, c; int getlength(int x, int y, int z) { return (x - y + 1) / (z); } int main() { int n, a, b, right, left; cin >> n >> a >> b; set<int> M; int sh = (n + 1) / (b + 1); n++; b++; M.insert(0); M.insert(n); int m, x; ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Sun Apr 09 09:37:58 2017 // Host : GILAMONSTER running 64-bit major release (...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: rain.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===================================...
#include <bits/stdc++.h> using namespace std; int main() { string x; getline(cin, x); sort(x.begin(), x.end()); int res = unique(x.begin(), x.end()) - x.begin(); if (res % 2 == 0) { cout << CHAT WITH HER! ; } else { cout << IGNORE HIM! ; } 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 law...
//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 associated do...
#include <bits/stdc++.h> using namespace std; int main() { int already = 0; int n, k; cin >> n >> k; int ans = 0; for (int i = 0; i < k; ++i) { int cnt; cin >> cnt; int first; cin >> first; if (first == 1) { int good = 1; already = 1; --ans; ...
#include <bits/stdc++.h> using namespace std; long long power(long long base, long long pow, long long mo) { long long res = 1; while (pow) { if (pow % 2 != 0) res = (res * base) % mo; base = (base * base) % mo; pow /= 2; } return res; } long long inv(long long i) { return powe...
/* Copyright (c) 2014-2018 Alex Forencich 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, publish, distri...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2011, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI...
#include <bits/stdc++.h> template <typename T> extern inline void SWAP(T &a, T &b) { T t = a; a = b, b = t; } const int MAXN = 500005; const int MAXBIT = 20; const int MEMBIT = MAXBIT + 5; int bas[MEMBIT], pos[MEMBIT], n, rt, a[MAXN], q; struct quest { int lt, rt, id; bool operator<(cons...
#include <bits/stdc++.h> using namespace std; long long a[20]; long long b[20]; int getbit(long long x) { int ret = 0; while (x) { x /= 10; ++ret; } return ret; } int main() { a[1] = 9; b[1] = 9; for (int i = 2; i <= 18; ++i) b[i] = b[i - 1] * 10 + 9; for (int i =...
module hardcaml_lib_add #(parameter b=1) ( input [b-1:0] i0, input [b-1:0] i1, output [b-1:0] o ); assign o = i0 + i1; endmodule module hardcaml_lib_sub #(parameter b=1) ( input [b-1:0] i0, input [b-1:0] i1, output [b-1:0] o ); assign o = i0 - i1; endmodule module hardcaml_lib_mulu #...
#include <bits/stdc++.h> using namespace std; int en[100004]; long long int dp[100004][3]; string x[100004]; int n; long long int sol(int i, int ck) { if (i > n) return 0; if (dp[i][ck] != -1) return dp[i][ck]; string org = x[i]; long long int ans = 0; long long int ans1 = 0; if (!ck...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s; cin >> s; queue<string> q; set<string> st; int ans = 0; q.push(s); st.insert(s); while (!q.empty() && int(st.size()) < k) { string v = q.front(); q.pop(); for (int ...
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, k[30]; string s; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> a >> s; for (b = 1; b < a; b++) { if (s[b] < s[b - 1]) { cout << YES << endl; cout << b << << b + 1; re...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:06:50 12/01/2014 // Design Name: // Module Name: Registrodesplazamiento // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
#include <bits/stdc++.h> using namespace std; long long n, k; int log2(long long x) { int ret = 0; while (x > 0) { x /= 2; ret++; } return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); clock_t ck; ck = clock(); cin >> n >> k; ...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long T = 0; int f = 0; char c = getchar(); for (; c < 0 || c > 9 ; c = getchar()) f |= c == - ; for (; c >= 0 && c <= 9 ; c = getchar()) T = T * 10 + c - 0 ; return f ? -T : T; } const double eps = 1e-7;...
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { ios_base::sync_with_stdio(false); long long int N, M; cin >> N >> M; long long int max_n1; for (max_n1 = 1; (max_n1 * (max_n1 - 1)) / 2 + 1 <= N; max_n1 += 2) ; max_n1 -= 2; long long int max_n2; f...
#include <bits/stdc++.h> using namespace std; mt19937 mt_rand(time(0)); const int N = 105; int t, n; char a[N], b[N], c[N]; int main() { scanf( %d , &t); while (t--) { scanf( %s%s%s , a, b, c); n = 0; while (a[n]) n++; bool ok = 1; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; long long q, n, c[30], r, a[100001]; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == ) ) { c[1]--; if (c[1] < 0) c[2] += 2; } else c[1]++; ...
#include <bits/stdc++.h> int main() { int n, b; scanf( %d%d , &n, &b); int a[100], s = b; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); s += a[i]; } for (int i = 0; i < n; i++) if (s < a[i] * n) { puts( -1 ); return 0; } for (int i = 0; i < n; i+...
module pipeline1( clk_in, // clock_in RST, // reset pc_chg, // indica mudanca do PC fora do pipeline 1 pc_in, // entrada - contador de programa instr, // instrucao pc_out // saida - contador de programa ); // faz o include dos parameters das instrucoes `include ...
#include <bits/stdc++.h> using namespace std; void fre() { freopen( c://test//input.in , r , stdin); freopen( c://test//output.out , w , stdout); } template <class T1, class T2> inline void gmax(T1 &a, T2 b) { if (b > a) a = b; } template <class T1, class T2> inline void gmin(T1 &a, T2 b) ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long int LINF = 0x3f3f3f3f3f3f3f3fll; const long double pi = acos(-1); const int MOD = 1e9 + 7; int main() { int n, i; double ans = 0.0; scanf( %d , &n); for (i = 1; i <= n; i++) { ans += 1 / (float)i;...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2014 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ V...
#include <bits/stdc++.h> using namespace std; map<string, int> m1, m2; void go(string s, map<string, int>& mp) { if (mp.find(s) != mp.end()) { return; } mp[s] = 1; if (s[0] == X ) { string s1 = s; string s2 = s; swap(s1[0], s1[1]); swap(s2[0], s2[2]); go(s1, mp...
#include <bits/stdc++.h> using namespace std; const int64_t mod = 1000000007; int main() { int n; cin >> n; int64_t ways = 1; for (int i = 0; i < 3 * n; ++i) { ways *= 3; ways %= mod; } int64_t bad = 1; for (int i = 0; i < n; ++i) { bad *= 7; bad %= mod; } ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, m, k, u, v, c[200005] = {}, d[200005] = {}, z = 0; vector<int> g[200005] = {}; cin >> n >> m >> k; for (int i = 1; i <= n; i++) cin >> c[i]; for (int i = 0; i < m; i++) cin >> u >> v, g[u].pu...
#include<bits/stdc++.h> using namespace std; #define sfd(x) scanf( %d ,&x) #define sfd2(x,y) scanf( %d%d ,&x,&y) #define sfd3(x,y,z) scanf( %d%d%d ,&x,&y,&z) #define sfs(x) scanf( %s ,x) #define sfll(x) scanf( %lld ,&x) #define sfll2(x,y) scanf( %lld%lld ,&x,&y) #define pfd(x) printf( %d ,x) #define p...
#include <bits/stdc++.h> using namespace std; long long mul(long long a, long long b) { return (a * b) % 1000000007; } long long add(long long a, long long b) { a += b; if (a >= 1000000007) a -= 1000000007; return a; } long long binary_expo(long long base, long long expo) { long long res = 1; ...
#include<iostream> #include<algorithm> #include<vector> #include<bitset> #include<time.h> using namespace std; #define R register int bitset<200000>S[60]; bool c[60]; int main(){ srand(time(0)); int n,m,p,q; cin>>n>>m>>p; q=n-1>>1; string s; for(R i=0;i!=n;i++){ cin>>s; for(R...
`timescale 1ns / 1ps // @module // top module // @input // clk_src: bind to E3(100Hz) // power: electric power // enable: enable switch(pause switch) // reset: reset switch // add_time/sub_time: add/sub time manually // timing_clock_switch: switch for enabling to change timing clock // timing_clock_disable: shutdown 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 law...
#include <bits/stdc++.h> using namespace std; int Day12[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int prime100[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103}; template <typename T> inline bool isLeap(T y) { ...
`include "DEF.v" module dcache(clock, address, data, read, write, rs_ex_ok, out_address, out_data, out_read, out_write, in_databus, out_databus, write_databus); input [31:0] address; inout [31:0] data, out_data; input read, write; input [63:0] in_databus; input clock; output [31:0] out_address; output out...
#include <bits/stdc++.h> using namespace std; const int LIM = 1e+5 + 100; int n, m, k; int get_rd(int i, int j) { if (i == j) { return n; } else if (i < j) { return n + (j - i); } else { return n - (i - j); } } int get_ld(int i, int j) { if (i + j == n) { return n...
#include <bits/stdc++.h> using namespace std; const long long K = 10001; signed main() { long long n, l, r, ans = 0; cin >> n >> l >> r; vector<long long> a(n), b(n); for (long long i = 0; i < n; i++) cin >> a[i]; for (long long i = 0; i < n; i++) cin >> b[i]; vector<long long> bad, good; ...
#include <bits/stdc++.h> using namespace std; int n, m; int R[101]; double dp[100100], sum[100100]; int main() { scanf( %d%d , &n, &m); if (m == 1) { puts( 1 ); return 0; } int score = 0; dp[0] = 1; double f = 1. / (m - 1); for (int i = 0; i < n; ++i) { scanf( %d ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2009 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Version : 11....
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; double lo = 0.0, hi = 10000000.0; for (int i = 1; i <= n; i++) { int sta; cin >> sta; lo = max(lo, (double)10.0 * sta / i); hi = min(hi, (double)10.0 * (sta + 1) / i); } int nextlo = floor(lo ...
#include <bits/stdc++.h> using namespace std; int main() { string s; string s2; cin >> s >> s2; transform(s.begin(), s.end(), s.begin(), ::tolower); transform(s2.begin(), s2.end(), s2.begin(), ::tolower); if (s == s2) { printf( 0 n ); } else if (s < s2) { printf( -1 n ); ...
#include <bits/stdc++.h> using namespace std; int n, m, cnt[10], sta[10], g[10][10], f[10][10], pru[10], deg[10], tag[10]; char s[10]; int cal(int x) { int res = 0; while (x) { res++; x /= 10; } return res; } int read() { scanf( %s , s); int res = 0; for (int i = 0; s...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Iztok Jeras. module t (/*AUTOARG*/); logic [3:0] array_simp [1:0] [3:0]; // big endian array initial begin array_simp[0] = '{ 4'd3, 4'd2, 4'd1, 4'd0}; if ...
/* * Zet processor core * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; 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,...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 02:10:17 05/08/2017 // Design Name: axi_spi_if // Module Name: D:/Projects/Rendszerarch/axi_spi_master_if/axi_spi/axi_spi_test.v // Project Name: axi_spi // Target D...
/* * 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> s[10]; int n1, n2; int ok(int a, int b) { int sum = a + b * 2; int len = 0; for (int i = 0; i < n1 - a; i++) len += s[1][i]; for (int i = 0; i < n2 - b; i++) len += s[2][i]; return len <= sum; } int main() { int a, b, n, m, 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...
/////////////////////////////////////////////////////////////////////////////// // // Module: ip_checksum_ttl.v // Project: NF2.1 reference router // Description: Check the IP checksum over the IP header, and // generate a new one assuming that the TTL gets decremented. // Check if the T...
#include <bits/stdc++.h> using namespace std; const int N = 500001; const int oo = 1e9; const int LOGN = 20; const int MOD = 1000000007; const double PI = acos(-1); int n, a[N]; int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; } int mn = oo, idx = -1; for (int ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Tue May 30 11:55:09 2017 // Host : GILAMONSTER running 64-bit major release (...
// Copyright (C) 2020-2021 The SymbiFlow Authors. // // Use of this source code is governed by a ISC-style // license that can be found in the LICENSE file or at // https://opensource.org/licenses/ISC // // SPDX-License-Identifier:ISC module top ( input clk, output [3:0] led, inout out_a, output [1: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...
#include <bits/stdc++.h> using namespace std; char s[1000010]; int n, p[1000010]; int main() { scanf( %s , s), n = strlen(s); for (int i = 0; i < n; i++) if (s[i] == 1 ) p[n - 1 - i] = 1; for (int i = 0, j; i < n + 2;) if (!p[i]) i++; else { j = i; while (p...
#include <bits/stdc++.h> using namespace std; int n, s, e; long long x[5001]; long long a[5001]; long long b[5001]; long long c[5001]; long long d[5001]; long long pd[5001][5001]; long long func(int at, int comp, int left, int right) { if (comp <= 0 && at != 0) return 0x3f3f3f3f3f3f3f3fll; if ...