ZOJ 3483 简单if-else】的更多相关文章

提醒:答案要约分,不然会错! #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdio.h> #include<string.h> #include<math.h> using namespace std; ; int prime[MAXSIZE]; void init_prim(){ ;i<MAX…
先上题目: Gaussian Prime Time Limit: 3 Seconds      Memory Limit: 65536 KB In number theory, a Gaussian integer is a complex number whose real and imaginary part are both integers. The Gaussian integers, with ordinary addition and multiplication of compl…
WERTYU Time Limit: 2 Seconds      Memory Limit: 65536 KB A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and s…
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <stdio.h> #include <string.h> int main() { char cText[1000]; char start[10]; char end[5]; while(scanf("%s",start)!=EOF&&strcmp(start…
在网上总是查不到很系统的练ACM需要学习的数据结构资料,于是参考看过的东西,自己整理了一份. 能力有限,欢迎大家指正补充. 分类主要参考<算法竞赛入门经典训练指南>(刘汝佳),山东大学数据结构模板 ⊙基本数据结构 1.链表: 块状链表:没练过 Dancing Links:用于优化搜索.解决精确覆盖问题和重复覆盖问题的利器. Knuth教授的始祖论文:Dancing Links中文版 Dancing Links介绍(这篇对DLX的工作过程演示的很详细) DLX——Dancing Links(这篇…
ZOJ Problem Set - 1622 Switch Time Limit: 2 Seconds      Memory Limit: 65536 KB There are N lights in a line. Given the states (on/off) of the lights, your task is to determine at least how many lights should be switched (from on to off, or from off…
题目大意:不超过10种气体,两两之间相互碰撞可以产生一定的能量,如a碰b,那么b气体就消失,自身不能碰自身,问最后所能得到的最大能量. 原代码链接:http://blog.csdn.net/accry/article/details/6607703 题解:感觉这个题是我做状态压缩的几个题中最简单的了,这存图用a数组就可以了,也不用处理a数组(有的求路径的题要用弗洛伊德处理原数组),因为碰撞是不可逆的. 接着就用s开始从0枚举状态到1<<N-1,还要注意去掉不可能的情况!! AC代码: #inc…
题目 //好一道水水题,可是我居然也错了那么多次,后来百度来发现是因为数据数位可能很长很长,要用字符串数组... //简单 //有坑啊——数据可能很大很大,要用字符串表示! #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { ]; while(scanf("%s",s)!=EOF) { )break; //无论如何,加一遍…
题目 对于案例的解释请见下图: 这道要变动提取一下矩阵,之后就简单了 具体解释可看代码: #include <string.h> #include <stdio.h> #include<algorithm> using namespace std; int num; struct matrix { ][];//把每次倒水的比率提取出来放在这里面,例如i倒给j几分之几,以便进行计算 }origin,answ;//answ保存提取出来比率计算后的答案 matrix mult…
题目链接 题意 : 问一个m×n的矩形中,有多少个pocket,如果两块油田相连(上下左右或者对角连着也算),就算一个pocket . 思路 : 写好8个方向搜就可以了,每次找的时候可以先把那个点直接变为*,这样可以避免重复搜索. //POJ 1562 ZOJ 1709 #include <stdio.h> #include <string.h> #include <iostream> #include <stack> #include <algori…