codeforces Simple Molecules】的更多相关文章

link:http://codeforces.com/contest/344/problem/B 刚开始想复杂了.一开始就想当然地以为可以有多个点,其实,人家题目要求只有3个点啊! 然后题目就简单了. A.B.C代表原子的化合价 x.y.z代表原子之间的化学键 首先x+y+z一定为偶数,否则不可能有解. 那么可以列出一个三元一次的方程组,由3个方程组成,可以求出唯一解. 判断有解的唯一限制条件是:不能出现负数. #include <cstdlib> #include <cstdio>…
CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecules Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u id=46665" class="login ui-button ui-widget ui-state-default…
Simple Molecules time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecul…
题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom in the molecule must be equal to its valence number. 给定三个原子的化学价,规定化学价数等于该原子与另外两个原子所连接的原子键之和. 又一次把简单问题复杂化了.....(以下注释部分读者可以忽略) /* 一开始三重循环枚举,绝对超时(10^6 * 1…
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); int ab=a+b-c,bc=b+c-a,ac=a+c-b; if(ab>=0&&bc>=0&&ac>=0&&ab%2==0&&bc%2==0&&ac%2==0)…
http://codeforces.com/contest/344/problem/B #include <cstdio> #include <cstring> using namespace std; int main() { int a,b,c; ,t2=,t3=; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { bool flag=false; ; i<=a; i++) { t1=i; ) { t…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output   Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule. A molecule c…
这次比赛出的题真是前所未有的水!只用了一小时零十分钟就过了前4道题,不过E题还是没有在比赛时做出来,今天上午我又把E题做了一遍,发现其实也很水.昨天晚上人品爆发,居然排到Rank 55,运气好的话没准能领到T-shirt.除此之外,锁上程序之后,看到一个人数组开小了,我还提交了一个大数据,成功Hack了一次,然后Room排名顿时升到第1. My submissions     # When Who Problem Lang Verdict Time Memory 4474604 Sep 15,…
A. Magnets 模拟. B. Simple Molecules 设12.13.23边的条数,列出三个等式,解即可. C. Rational Resistance 题目每次扩展的电阻之一是1Ω的,所以假设当前的电阻为\(\frac{a}{b}\)会变成\(\frac{a+b}{b}\)或\(\frac{a}{a+b}\),其实就是求gcd的过程. D. Alternating Current 若出现连续两个相同的符号,其实线的方向是不变的,最后就是转化成括号匹配. E. Read Time…
http://open.sina.com.cn/course/id_1047/ What scientists do is not just collect data and collect facts and stick them in big books,and what's more ,their main job is to talk to each other about what they don't know. They really do care about a kind of…
E. A Simple Task Problem's Link: http://codeforces.com/problemset/problem/558/E Mean: 给定一个字符串,有q次操作,每次操作将(l,r)内的字符升序或降序排列,输出q次操作后的字符串. analyse: 基本思想是计数排序. 所谓计数排序,是对一个元素分布较集中的数字集群进行排序的算法,时间复杂度为O(n),但使用条件很苛刻.首先对n个数扫一遍,映射出每个数字出现的次数,然后再O(n)扫一遍处理出:对于数字ai,…
E. Simple Skewness time limit per test:3 seconds memory limit per test:256 megabytes input:standard input output:standard output Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list…
题目链接:http://codeforces.com/contest/558/problem/E E. A Simple Task time limit per test5 seconds memory limit per test512 megabytes inputstandard input outputstandard output   This task is very simple. Given a string S of length n and q queries each qu…
E. A Simple Task 题目连接: http://www.codeforces.com/contest/558/problem/E Description This task is very simple. Given a string S of length n and q queries each query is on the format i j k which means sort the substring consisting of the characters from…
题目链接: http://codeforces.com/problemset/problem/558/E E. A Simple Task time limit per test5 secondsmemory limit per test512 megabytes 问题描述 This task is very simple. Given a string S of length n and q queries each query is on the format i j k which mea…
D. Simple Subset 题目连接: http://www.codeforces.com/contest/665/problem/D Description A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i,  j) (1  ≤ i  <  j ≤ k), xi  +  xj is a prime. You are given a…
C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add a…
A Simple Task CodeForces - 11D 题意:输出一个无向图的简单环数量.简单环指无重复边的环.保证图无重边自环. ans[i][j]表示"包含i中的点,以i中第一个点为起点,以j为终点"的路径条数. 对于某个i,枚举当前终点j(显然不能是首个点),产生一个状态.再枚举上一次终点k,如果能转移就转移. 如果i中点数大于2且j到i中第一个点有路,就认为产生了环.最后每个环记录了两遍,要除以2. #include<cstdio> #include<c…
原题: http://codeforces.com/contest/570/problem/B 题目: Simple Game time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output One day Misha and Andrew were playing a very simple game. First, each player choo…
time limit per test5 seconds memory limit per test512 megabytes inputstandard input outputstandard output This task is very simple. Given a string S of length n and q queries each query is on the format i j k which means sort the substring consisting…
题目描述:  A Simple Task time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or…
题目连接:http://codeforces.com/contest/962/problem/F 题目大意是定义一个simple cycle为从一个节点开始绕环走一遍能经过simple cycle内任何一个节点,并且不超过一次. 因为是无向图,而且是环,即为连通分量,所以模型转化为求点双连通分量,依据题意求得的点双连通分量需要满足题目simple cycle的定义,所以当一个点双连通分量的边数量和点数量相等时才能构成simple cycle,在tarjan求割点的时候,需要存储点双联通分量的点和…
题目链接:http://codeforces.com/contest/558/problem/E 题意:有一串字符串,有两个操作:1操作是将l到r的字符串升序排序,0操作是降序排序. 题解:建立26棵线段树,类似计数排序思想. #include <bits/stdc++.h> using namespace std; ; struct SegTree { ], sum[], l, r; }T[N << ]; ][N]; void pushup(int p, int c) { T[p…
B. Simple Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let'…
题目大意就是给一个字符串,然后多个操作.每次操作能够把每一段区间的字符进行升序或者降序排序,问终于的字符串是如何的. 做法的话就是用线段树维护区间和 一開始仅仅考虑字符串中字符'a'的情况.如果操作区间[L,R]中有x个'a',那么一次操作后,这x个'a'要么去最左(升序).要么去最右(降序),我们能够建立一颗线段树来维护这种操作,字符'a'出现的位置值为1,否则为0,那么q次操作后,最后值为1的地方填的就是'a'了. 然后,在考虑字符'a'和'b'的情况,操作的情况和上面类似,字符'a'和'b…
状态压缩/Bitmask 在动态规划问题中,我们会遇到需要记录一个节点是否被占用/是否到达过的情况.而对于一个节点数有多个甚至十几个的问题,开一个巨型的[0/1]数组显然不现实.于是就引入了状态压缩,用一个整数的不同二进制位来表示该节点的状态. Description Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices…
http://codeforces.com/contest/962/problem/F 求没有被两个及以上的简单环包含的边 解法:双联通求割顶,在bcc中看这是不是一个简单环,是的话把整个bcc的环加到答案中即可(正确性显然,因为bcc一定是环了,然后如果一个bcc不是简单环,那么所有边一定包含在两个简单环中) //#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast,no-stac…
This task is very simple. Given a string S of length n and q queries each query is on the format i j k which means sort the substring consisting of the characters from i to j in non-decreasing order if k = 1 or in non-increasing order if k = 0. Outpu…
题目链接  A Simple Task 题意  给出一个小写字母序列和若干操作.每个操作为对给定区间进行升序排序或降序排序. 考虑权值线段树. 建立26棵权值线段树.每次操作的时候先把26棵线段树上的所有在该区间内的信息清空. 然后再通过类似计数排序的方式从左往右(或从右往左)依次塞进去. #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) #de…
Discription Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges. Input The first line of input contains two integers n and m (1 ≤ n ≤ 19, 0 ≤ m) – respectively the number of ver…