刷题
文章平均质量分 77
qiuchenl
这个作者很懒,什么都没留下…
展开
-
[c++] 大整数乘法(字符串乘法)
#include#include#includeusing namespace std;string add(string a,string b){ if(a.length()==0) return b; if(b.length()==0) return a; a.length()<b.length()?a.swap(b):a.length(); reverse(a原创 2014-01-02 10:26:50 · 7507 阅读 · 0 评论 -
[sicily online]1045. Space Management
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionThe new general manager Gill Bates has been to a seminar on time management. Ever since she has been bothering all of her staff原创 2012-12-09 14:09:54 · 619 阅读 · 0 评论 -
[sicily online]1029. Rabbit
/*1,大整数加法,用string模拟2,用一个数组模拟兔子成长过程ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionThe rabbits have powerful reproduction ability. One pair of adult rabbits can give birth to one原创 2012-11-24 21:22:03 · 987 阅读 · 0 评论 -
[sicily online]1070. Hansel and Grethel
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionOn a warm summer afternoon, Hansel and Grethel are walking together in the fields. It is getting late and, to be honest, th原创 2012-12-08 15:11:52 · 1202 阅读 · 0 评论 -
[sicily online]1077. Cash Machine
ConstraintsTime Limit: 10 secs, Memory Limit: 32 MBDescriptionA Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate bills for a requested ca原创 2012-12-08 13:59:33 · 1056 阅读 · 0 评论 -
[sicily online]1063. Who's the Boss
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionSeveral surveys indicate that the taller you are, the higher you can climb the corporate ladder. At TALL Enterprises Inc. this原创 2012-12-07 19:12:59 · 1810 阅读 · 1 评论 -
[silicy line]1089. Farey Sequence
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 F2 = {1/2}F3 = {1原创 2012-12-07 22:07:19 · 612 阅读 · 0 评论 -
[sicily online]1017. Rate of Return
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionJill has been investing in a mutual fund for a while. Since her income has varied, the amount of money she has added to the investmen原创 2012-12-06 15:47:48 · 597 阅读 · 0 评论 -
[sicily online]1027. MJ, Nowhere to Hide
/*用两个map来实现ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionOn BBS, there is a familiar term called MJ (short for MaJia), which means another BBS ID of one person besides his/her ma原创 2012-11-24 15:08:02 · 812 阅读 · 0 评论 -
[cisily online]1021. Couples
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionN couples are standing in a circle, numbered consecutively clockwise from 1 to 2N. Husband and wife do not always stand tog原创 2012-11-24 14:13:21 · 1224 阅读 · 0 评论 -
[sicily online]1014. Specialized Four-Dig
/*ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionFind and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of原创 2012-11-23 21:23:58 · 1113 阅读 · 0 评论 -
[sicily online]1007. To and Fro
/*ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionMo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message原创 2012-11-23 16:49:51 · 915 阅读 · 0 评论 -
[poj] 1001 Exponentiation
DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many co原创 2012-11-23 16:01:01 · 626 阅读 · 0 评论 -
[sicily online]1010. Zipper
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionGiven three strings, you are to determine whether the third string can be formed by combining the characters in the first two s原创 2012-12-07 10:29:00 · 771 阅读 · 0 评论 -
[sicily online]1050. Numbers & Letters
ConstraintsTime Limit: 3 secs, Memory Limit: 32 MBDescriptionIn the early 80’s, a popular TV show on Dutch television was ‘Cijfers en Letters’ (Numbers and Letters). This game consisted of原创 2012-12-10 11:20:48 · 1250 阅读 · 1 评论 -
[sicily online]1194. Message Flood
/*大小写不区分,没看到,提交了好几次我的map,感觉set应该更好ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionWell, how do you feel about mobile phone? Your answer would probably be something like that “It’原创 2012-12-10 22:43:24 · 2065 阅读 · 0 评论 -
hdu 1221 Rectangle and Circle(矩形与圆焦点问题)
求平面内矩形与圆是否有焦点,分别求出圆点到矩形四个边的交点,判断交点是否在边上#include#includeusing namespace std;bool xiao(double x1,double x2){ if(x1-x2<1e-8) return true; else false;}int main(){ int num; double x,y,r,x1原创 2013-05-09 20:13:22 · 1533 阅读 · 0 评论 -
1045: [HAOI2008] 糖果传递(数学法,求中位数)
基本方法就是数学分析:设p(i)表示i-1节点向i节点要糖果的数量(有符号,表示方向),avg表示糖果数的均值,也就是目标糖果数,设p(1)=k 也就是节点n向节点1要的糖果数。则存在以下公式:p(2)=p(1)+avg-a[1]p(3)=p(2)+avg-a[2]=(2*avg)-(a[1]+a[2])-k;p(i)=p(i-1)+avg-a[i-1]=(i-1)*avg-(a[1]原创 2013-05-07 15:37:46 · 2118 阅读 · 0 评论 -
指定日前的前后n天问题
问题描述:给定日期,求距离n天的前后日期int month(int y, int m){ if (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) return 31; if (m==4 || m==6 || m==9 || m==11) return 30; if (y%4==0 && y%100!=0 ||原创 2013-03-30 13:00:21 · 713 阅读 · 0 评论 -
[sicily online]1155. Can I Post the lette(图的深度优先搜索)
#include#include#include#include#include#include#includeusing namespace std;int main(){ int n,m; while(cin>>n&&n!=0) { cin>>m; map > gra; vector flag(n); for(int i=0;i<m;i++) {原创 2013-03-08 16:52:54 · 1574 阅读 · 0 评论 -
[sicily online]1159. Sum(字符串加法)
#include#include#include#include#includeusing namespace std;int main(){ int n; while(cin>>n&&n>0) { vector data(n); string sum("0"); for(int i=0;i<n;i++) { cin>>data[i]; revers原创 2013-03-08 16:24:02 · 1178 阅读 · 0 评论 -
[sicily online]1156. Binary tree(递归先序遍历)
//用map来存储图//递归先序遍历#include#include#include#includeusing namespace std;typedef struct NODE{ char value; int parent; int lchild; int rchild; //struct NODE():value('\0'),parent(0),lchild(0)原创 2012-12-19 10:26:44 · 1398 阅读 · 0 评论 -
[sicily online]1146. 采药(0-1背包)
/*经典0-1背包问题ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草药,采每一株都需要一些时间,每原创 2012-12-18 19:47:17 · 1784 阅读 · 0 评论 -
[sicily online]1097. LED Modding
/*普通计算题,只要注意,给的电压小于额定电压也是工作的,但是小于等于0除外ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionPC Modding has become the latest trendy hobby sweeping the nation. Since you don't have too m原创 2012-12-13 11:22:11 · 636 阅读 · 0 评论 -
[sicily online]1049. Mondriaan
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One day, while working on his latest project, he原创 2012-12-13 18:50:25 · 803 阅读 · 0 评论 -
[sicily online]1151. 魔板
题目分析:简单魔板由于N比较小,所以可以用暴力DFS,但是这个题目N比较大,所以要进行状态判断一共有8!个状态,需要把这些状态对应到整数上去,正好是康拓展开所以本题DFS+康拓展开#include #include #include #include #include #include #include #include #include原创 2012-12-12 16:42:14 · 622 阅读 · 0 评论 -
[sicily online]1198. Substring
/*用sort默认排序的话,考虑ba和bConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionDr lee cuts a string S into N pieces,s[1],…,s[N]. Now, Dr lee gives you these N sub-strings: s[1],…s[N]. The原创 2012-12-11 16:19:05 · 1042 阅读 · 0 评论 -
[sicily online]1033. City Road
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionLong long ago, city Old was all around the water and was divided into M*N small square houses. The city Old had only two bridges, in原创 2012-12-10 20:45:43 · 668 阅读 · 0 评论 -
[sicily online]1150. 简单魔板
/*这个题要想清楚是用dfs还是bfs,dfs可能会得出不正确结果,例如AAAB所以用队列实现bfsConstraintsTime Limit: 1 secs, Memory Limit: 32 MB , Special JudgeDescription魔板由8个大小相同方块组成,分别用涂上不同颜色,用1到8的数字表示。其初始状态是1 2 3 48 7 6 5对魔板可进行原创 2012-12-11 11:14:56 · 2640 阅读 · 0 评论 -
[sicily online]1048. Inverso
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionThe game of ‘Inverso’ is played on a 3x3 grid of colored fields (each field is either black or white). Each field is numbered a原创 2012-12-06 21:32:04 · 1528 阅读 · 0 评论 -
[sicily online]1099. Packing Passengers
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionPTA, Pack ‘em Tight Airlines is attempting the seemingly impossible—to fly with only full planes and still make a profit. T原创 2012-12-06 10:57:10 · 1208 阅读 · 0 评论 -
[sicily online]1034. Forest
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionIn the field of computer science, forest is important and deeply researched , it is a model for many data structures . Now it’s your原创 2012-11-30 16:30:09 · 1869 阅读 · 0 评论 -
[poj]1002.487-3279
/*用两个map来存数据DescriptionBusinesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call t原创 2012-11-30 09:51:52 · 603 阅读 · 0 评论 -
[sicily online]1022. Poor contestant Prob
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionAs everybody known, “BG meeting” is very very popular in the ACM training team of ZSU. After each online contest, they wi原创 2012-11-29 20:48:14 · 1338 阅读 · 1 评论 -
[sicily online]1006. Team Rankings
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionIt's preseason and the local newspaper wants to publish a preseason ranking of the teams in the local amateur basketball league原创 2012-11-28 16:55:32 · 1544 阅读 · 0 评论 -
[sicily online]1035. DNA matching
/*用map,注意重复ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionDNA (Deoxyribonucleic acid) is founded in every living creature as the storage medium for genetic information. It is comp原创 2012-11-27 19:38:56 · 1391 阅读 · 0 评论 -
[sicily online]1093. Air Express
/*ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionFly It Today! (FIT), an air express company, charges different amounts for packages depending on their weight. For example, one set原创 2012-11-27 21:40:53 · 1671 阅读 · 0 评论 -
[sicily online]1031. Campus
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionAt present, Zhongshan University has 4 campuses with a total area of 6.17 square kilometers sitting respectively on both sides of the原创 2012-11-27 10:24:45 · 882 阅读 · 0 评论 -
[sicily online]1028. Hanoi Tower Sequence
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionHanoi Tower is a famous game invented by the French mathematician Edourard Lucas in 1883. We are given a tower of n disks,原创 2012-11-26 20:43:51 · 2788 阅读 · 1 评论 -
[sicily online]1020. Big Integer
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionLong long ago, there was a super computer that could deal with VeryLongIntegers(no VeryLongInteger will be negative). Do yo原创 2012-11-26 16:05:25 · 895 阅读 · 1 评论