}publicclassMain {publicstaticvoidmain(String[] args) { Scanner in=newScanner(System.in);longans = 0;intn =in.nextInt(); String s=in.next(); String aa=null,bb =null; Map<Pair<String,String>,Integer> map =newHashMap();for(inti = 0;i < 1 << n;i ++) { StringBuilder a=newS...
看到别人的视频讲解AtCoder Beginner Contest 346 A 至 G 題讲解 by dreamoon C 如果用sort写,那么再从小到大遍历也需要写几行 #include <cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<cstdbool>#include<string>#include<algorithm>#include<iostream>#include<sstream>#include<ctime>#inclu...
void solve() { string s, x, y; int n, q, a, b, op; cin >> n >> s >> q; x = s.substr(0, n), y = s.substr(n, n); while (q--) { cin >> op >> a >> b; if (op == 2) swap(x, y); else { a--, b--; if (a > b) swap(a, b); if (b < n)...
得到序列中所有中位数比mid大的区间个数: 首先利用前缀和处理数组,将不小于mid的赋为1,其余赋为-1,这样我们就可以得到原序列中的前缀区间的值 参考代码: #include<cstdio> #include<algorithm> #include<vector> #include<iostream> #include #include<queue> #include<cstring> #include<string> #include<cstdl...
简介:AtCoder Beginner Contest 218 C - Shapes (模拟) linkkkk 题意: 给两个n ∗ n的矩阵,#表示物体所在位置,问1能否通过旋转90 °和平移任意次得到2 思路: 啊大概就是暴力模拟判断一下,然后就没想好怎么模拟。 首先,如果两个矩阵的#个数不相等,一定是N o ...
string_lexical_order.c string.hを導入、strlen関数を使用 Nov 22, 2019 tree_dfs.c 関数の追加 Oct 25, 2019 union_ford.c union-ford構造の新規作成 Nov 22, 2019 Repository files navigation README C_function 私がよくAtCoderでよく使う関数をまとめました。 以下、upしたファイルの一つである「...
最近群友对int128这个东西讨论的热火朝天的。讲道理的话,编译器的gcc是不支持__int128这种数据类型的,比如在codeblocks 16.01/Dev C++是无法编译的,但是提交到大部分OJ上是可以编译且能用的。C/C++标准。IO是不认识__int128这种数据类型的,因此要自己实现IO,其他的运算,与int没有什么不同。
; map<string,int>d; d[s]=0; queue<string>q; q.push(s); while(!q.empty()) { auto ss=q.front(); q.pop(); int k=0; if(ss==t) { cout<<d[ss]<<endl;//如果一开始就相等放里面不可以判断 return; } while(ss[k]!='.')k++; for(int i=0;i+1<ss.size();i++) { ...
Problem :https://atcoder.jp/contests/abc169/tasks/abc169_c // Author : Epsilon573// If it works, don't touch it.#include<bits/stdc++.h>usingnamespacestd;typedeflonglongll;typedeflongdoubleld;intmain(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);ll a;ld b;cin...
[1000010]; static long[] base = {1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111, 11111111111L, 111111111111L}; static long[] ans = new long[1000010]; static int idx = 0; static int idxa = 0; public static void main(String[] args) { Scanner sc = new...