题目链接:https://codeforc.es/contest/1202/problem/B 题意: 给你一串数,问你插入最少多少数可以使x-y型机器(每次+x或+y的机器,机器每次只取最低位--%10)产生这个子序列. 解: 这题真的是...唉我真的,还是怪自己太弱吧,比如08888,8和前一个8相同的话你必须让机器输入东西(不能看着这串数反正都是一样就不输入). 就是预处理x-y型每次加(0~9)最少需要多少次就行了,刚上蓝就rank1900+,以后多多磨练吧. #define IOS i…
B. Beautiful Divisors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful…
题意:博弈题面  给出一个数字序列 (>=11)  有两个人任意删除数字 直到 数字只剩下11位 如果删除后的数字串开头是8那么就是第一个赢 否则就是第二个人赢 第一个人先手  数字序列一定是奇数长度 思路: 首先计算一共走多少步 第二个人想赢只有以下两种方法 想法1:如果第二个人能把8都删掉 那么第二个人肯定赢 想法2: 如果删不掉 那么第二个人肯定从前到后尽可能得删掉8 这样使得第一个人的步数不足删除从前到后 步数+1那个8 的其他字符 否则就是第一人赢,直接模拟即可 (比赛的时候一直WA…
A. Chess For Three time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decide…
题意:有\(n\)个队员,每个队友都有一个能力值,构造队伍,要求队伍人数*队伍中最低能力值不小于\(x\),求能构造的最大队伍数. 题解:大水题,排个序,倒着模拟就行了. 代码: int t; int n,x; ll a[N]; int ans; int main() { ios::sync_with_stdio(false);cin.tie(0); cin>>t; while(t--){ cin>>n>>x; ans=0; for(int i=1;i<=n;++…
#include<bits/stdc++.h>using namespace std;typedef long long ll;int n,k;ll a[200007],b[200007],s[200007];ll ans;int check(ll val){ memset(s,0,sizeof(s)); int num=k; for(int i=1;i<=n;i++){  if(!b[i])   continue;  s[min(a[i]/b[i]+1,1ll*(k+1))]++;//…
B. The Modcrab Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome monster called Modcrab. After two hours of playing the game Vova has tracked the monster and analyzed its tactics…
从低位到高位枚举,当前位没有就去高位找到有的将其一步步拆分,当前位多余的合并到更高一位 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; ],num[]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--){ memset(sum,,si…
#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],mx[],a[],pos[],sum[]; int n,m; int lowbit(int x){ return x&(-x); } void add(int x,int val){//单点更新 ){ sum[x]+=val; x+=lowbit(x); } } int ask(int x){//区间查询[1~n]的和 ; while(…
题意:有一长度为\(n\)的序列,问是否能找到\(a_{i}<a_{j},a_{j}>a_{k},(i<j<k)\),如果满足,输出其位置. 题解:直接暴力两头找即可,最坏复杂度:\(O(n^2)\). 代码: int t; int n; int a[N]; int main() { ios::sync_with_stdio(false);cin.tie(0); cin>>t; while(t--){ cin>>n; for(int i=1;i<=n;…
var Stack = (function(){ var items = new WeakMap(); //先入后出,后入先出 class Stack{ constructor(){ items.set(this,[]); } push(ele){ //入栈 var ls = items.get(this); ls.push(ele); } pop(){ //出栈 var ls = items.get(this); return ls.pop(); } size(){ //获取栈的长度 var…
传送门 签到题,直接瞎模拟就行了. 代码…
A. Comparing Two Long Integers 题目连接: http://www.codeforces.com/contest/616/problem/A Description You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal.…
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/problem/A Description You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon…
A. Carrot Cakes time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minut…
A. Diplomas and Certificates time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n students who have taken part in an olympiad. Now it's time to award the students. Some of them will…
A. Gabriel and Caterpillar 题目连接: http://www.codeforces.com/contest/652/problem/A Description The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h1 cm fro…
地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left…
题目链接:http://codeforces.com/contest/572/problem/A 题意 就给你两个数组,问你能不能从A数组中取出k个,B数组中取出m个,使得这k个都大于这m个. 题解 就模拟 代码 #include<iostream> #include<cstring> #include<algorithm> #define MAX_N 100005 using namespace std; int n0,n1; int k,m; int a[MAX_N…
A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to a…
#include<bits/stdc++.h>using namespace std;int n,x;int chess[17*17];//记录棋盘上的numberarray<int,2>pace[17*17*3][17*17*3],dp[17*17][3];//first记录root,second记录changearray<int,2>operator+(const array<int,2>a,const array<int,2> b){   …
D. Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Let's denote a function You are given an array a consisting of n integers. You have to calculate the sum of d(ai, aj) o…
C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mishka has got n empty boxes. For every i (1 ≤ i ≤ n), i-th box is a cube with side length ai. Mishka can put a box i into a…
B. The Modcrab time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome mons…
原题链接:http://codeforces.com/contest/572/problem/B 题意 很迷,自行看题. 题解 看懂题就会做了 代码 #include<iostream> #include<cstring> #include<algorithm> #define MAX_N 100005 using namespace std; int n,s; struct exchange { public: bool ty; int p, q; double sp…
Extract Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (sem…
题目相关 题目描述 请你编一程序实现两种不同进制之间的数据转换. 输入格式 共三行,第一行是一个正整数,表示需要转换的数的进制n(2≤n≤16),第二行是一个n进制数,若n>10则用大写字母A-F表示数码10-15,并且该n进制数对应的十进制的值不超过1000000000,第三行也是一个正整数,表示转换之后的数的进制m(2≤m≤16). 输出格式 一个正整数,表示转换之后的m进制数. 输入输出样例 输入 16 FF 2 输出 11111111 分析 阅读完题目之后可以发现,其实就是求解一个N进制…
java进制操作 1.二进制 二进制只有0和1,逢二进一 二进制多用在计算机中,来自计算机硬件的开关闭合 2.位运算 分别讲解: 2.1.按位与 & 两位全为1,结果才为1 0&0=0:1&0=0:1&1=1: 例如:51&5=1 0011 0011 & 0000 0101 = 0000 0001 位运算的特殊用法: 1.清零.如果想将一个单元清零,可使其全部二进制为0,只要与一个各位都为0的数值相与,结果就为零 2.取一个数中的指定位.方法是:找一个数,对…
/******************************************************************** created: 2014/03/16 22:56 filename: main.cpp author: Justme0 (http://blog.csdn.net/justme0) purpose: C++ 中数串互转.进制转换的类 **************************************************************…
* Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串. * @param src byte[] data * @return hex string */ public static String bytesToHexString(byte[] src){ StringBuilder stringBuilder = new StringBuilder(""); if…