- 博客(35)
- 收藏
- 关注
原创 C:参加派对
虽然写出来了,但是还是不太理解排序时的if…else…语句唉……等待老师解答!!#include #include #include #include #include #include using namespace std;typedef struct PartyType{ int start; int end; bool operator < (const
2013-10-21 23:58:56
620
原创 B:扫雷游戏
几乎就是UVA上的原题,说实话有点冷……看来有必要针对UVA的题多留意一点#include #include #include #include using namespace std;int main(){// ifstream cin ("mine.in");// ofstream cout ("estdout.pc2"); vectormine; int
2013-10-21 23:17:03
568
原创 A:罗马数字
字符串处理,没有什么特别的,本机不会测试文件输入输出流……#include #include #include using namespace std;int w[26];void init(){ memset(w, 0, sizeof(int)*26); w['I'-'A']=1; w['V'-'A']=5; w['X'-'A']=10; w['L'-'A']
2013-10-21 01:45:59
601
原创 uva 11384 正整数序列( Help is needed for Dexter)
11384 - Help is needed for DexterTime limit: 3.000 secondsProblem HHelp is needed for DexterTime Limit: 3 Second Dexter is tired of Dee Dee. So he decided to keep Dee Dee busy in a g
2013-09-25 18:06:49
492
原创 (uva 11464)偶数矩阵(Even Parity)
学位运算的时候以为用不上看了几眼直接就跳过了……结果这次吃亏了……在老师的指导下第一次学会了位运算,留念~具体见代码注释~11464 - Even ParityTime limit: 3.000 secondsDEven ParityInput: Standard InputOutput: Standard Output
2013-09-23 13:32:39
632
原创 (LA 2995)立方体成像(Image Is Everything )
什么也不能阻止我鸡血的挑战WF的决心!!!2995 - Image Is EverythingTime limit: 3.000 seconds Your new company is building a robot that can hold small lightweight objects. The robot will have the intelligence
2013-09-23 01:21:39
1186
原创 (uva 10881)蚂蚁(Piotr's Ants)
10881 - Piotr's AntsTime limit: 3.000 secondsProblem DPiotr's AntsTime Limit: 2 seconds"One thing is for certain: there is no stopping them;the ants will soon be here. And
2013-09-23 00:50:41
570
原创 (LA 3708)墓地雕塑(Graveyard )
3708 - GraveyardTime limit: 3.000 seconds Programming contests became so popular in the year 2397 that the governor of New Earck -- the largest human-inhabited planet of the galaxy -- opened a s
2013-09-23 00:22:37
1036
原创 (uva 11300)分金币(Spreading the Wealth)
11300 - Spreading the WealthTime limit: 6.000 seconds F. Spreading the Wealth ProblemA Communist regime is trying to redistribute wealth in a village. They have have
2013-09-23 00:03:28
602
原创 (uva 11729)突击战( Commando War)
11729 - Commando WarTime limit: 1.000 secondsGCommando WarInput: Standard InputOutput: Standard Output “Waiting for orders we held in the wood, word from
2013-09-22 23:18:11
821
原创 (uva 11292)勇士斗恶龙(The Dragon of Loowater)
11292 - Dragon of LoowaterTime limit: 1.000 seconds#include #include using namespace std;const int maxn = 20000+5;int A[maxn], B[maxn];int main(){ int n,m; while(scanf("%d%d", &n, &
2013-09-16 13:41:42
605
转载 next_permutation
#include #include using namespace std;int main(){ int n; int *p = new int[n]; scanf("%d",&n); for(int i=0; i<n; i++) scanf("%d",&p[i]); sort(p,p+n); do { for(int i=0; i<n; i++) print
2013-09-12 23:52:53
369
原创 奋战杭电ACM(DAY16)1023
被这道题虐死了……先是完全混乱,再一搜,卡塔兰数,数学没学过怎么办……有了递推式,开始写代码,大数乘除又虐了一次……全部写完了,提交——RE,泪……结果是数组开小了……尼玛开100还小!!开200过了……Train Problem IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768
2013-09-08 09:18:51
516
原创 奋战杭电ACM(DAY15)1034
这几天一直在看王晓东的《计算机算法设计与分析》,不得不承认,受益匪浅!但是……他能不能不要所有的算法都举一样的例子啊!!脑子不好的人很容易混乱好吗!!虽然早已经做好了看第二遍第三遍第四遍的准备,但是学时清楚学后混乱的感觉还是很不好啊啊啊啊啊!!!唉,军校的苦恼,不能从早到晚敲代码了,虽然争分夺秒地看书,但还是感觉生疏了好多……今天本来上午自习,下午党团活动,可以看一天书的……结果下
2013-09-07 23:47:32
676
原创 奋战杭电ACM(DAY14)1022
这道题本身不难,直接栈的应用做就可以了;学到了栈的新建,插入,删除,空判断等基本操作;标记数组很新颖嘛~~~Train Problem I#include #include #include using namespace std;int main(){ int n; string getin,getout; while(cin >> n
2013-09-06 00:59:55
474
原创 奋战杭电ACM(DAY13)1021
水题。吸取1005的教训,直接递归肯定超时,找规律,4个一循环。Fibonacci Again#include using namespace std;int main(){ int n; while(cin >> n) { switch(n%4) { case 2: cout << "yes" << endl;break;//一开始在纸上做,没注意大小写…
2013-09-05 12:49:43
511
原创 奋战杭电ACM(DAY12)1020
吸取1019的教训,这次考虑的全面啦,一次AC!Encoding#include #include using namespace std;int main(){ int N,count; cin >> N; string s; while(N>=1) { cin >> s; if(s[1]=='\0')//如果s只有1个字符,直接输出 { c
2013-09-04 23:44:03
553
原创 奋战杭电ACM(DAY12)1019
这道题不难,但是很考验基本功。我基本功不扎实,所以还是栽了跟头……一开始用大数翻倍法求LCM,结果很显然……TLE……后来改进了,用GCD求LCM,但是循环时漏了递减计数,一直死循环……还是TLE……后来好不容易改过来了,结果……WA了……忘了32-bit下溢出问题……求解最小公倍数时,先乘后除,乘法明显可能溢出……然后是数组大小,没有考虑大小为1 的情况,下标可能越界……
2013-09-04 23:02:39
762
原创 奋战杭电ACM(DAY12)1018
又是一道数学题,用对数求位数Big Number#include #include using namespace std;int main(){ int n,m; double sum,digit; while(cin >> n){ while(n>=1) { cin >> m; sum=0;
2013-09-04 00:23:07
545
原创 奋战杭电ACM(DAY11)1017
这题重点完全在格式……input、output的格式……输入N个方块,每个方块之间一个空行,输出N个方块,每个方块之间一个空行,每个方块之间相互独立。A Mathematical Curiosity#include using namespace std;int main(){ int N,n,m,num,NUM,block; cin >> N; block=0;
2013-09-03 22:06:13
626
原创 奋战杭电ACM(DAY11)1016
DFS加回溯具体见注释Prime Ring Problem#include using namespace std;int n,circle[20],p[20];bool visited[20];int prime[]={1,3,5,7,11,13,17,19,23,29,31,37};//建立素数表,避免每次判断,减少时耗void print(int x){
2013-09-03 18:27:01
495
原创 奋战杭电ACM(DAY10)1015
不见AC不睡觉!暴力,不解释居然过了……晚安~水水的~Safecracker#include #include #include #include using namespace std;bool cp(int a, int b){ return a>b;}int main(){ long target,n; int t[30
2013-09-02 01:26:25
486
原创 奋战杭电ACM(DAY9)1014
题目太考验人了,没耐心也看不懂啊!!大神表示这题就是判断是否互质,证明如下:令 f(x) = seed(x) + step ;那么seed 的序列 就是 a=f(x) 的模MOD 加法群。因为题中要求这个加法群的大小 | | = MOD。所以 a == 1 (mod MOD ).即( seed(x) + STEP ) == 1 (mod MOD).又因为seed(x)
2013-09-01 18:54:57
501
原创 奋战杭电ACM(DAY9)1013
Digital Roots#include #include using namespace std;int main(){ string s;//溢出神烦哈! int m,n,i; while(cin >> s) { m=0; if(s[0]=='0') break; for(i=0; s[i
2013-09-01 18:48:36
535
原创 奋战杭电ACM(DAY9)1011
开学了,用电脑时间越来越少,军校一大麻烦,班长还特别贱,心情极度不好。直接发题,尽量写注释。Starship Troopers#includeusing namespace std;const int MAXN=110;int N,M;struct Node{ int number,p;//p:该结点的possible;number:该结点的bug数};Node
2013-09-01 18:45:42
806
原创 奋战杭电ACM(DAY6)1010
纠结了两天的题,一开始自己想不出来,上网搜前辈的解题报告,没看懂……对算法掌握太少了,知道知识点是深度优先遍历(DFS)和剪枝(本题特殊在奇偶剪枝),于是花了一天的时间学习这两个知识点,到处翻书哇!!于是还是没做出来……但是又结合前辈的解题报告,这次能看懂了!!然后自己做,失败2次……第三次解决了!!提交,一次AC!!作对这道题成就感胜过昨天AC4到啊!!总结一下,本题的思路还是很
2013-08-29 20:04:25
491
原创 奋战杭电ACM(DAY5)1012
好吧这又是一道水题……今天第四题……前面几题的算法都没接触过啊啊啊啊啊!!!疯了……军校神烦晚上不能看书,尼玛,明天白天好好看书思考后再写前几题。以上。u Calculate e#include #include using namespace std;int plus(int a){ if(a==0) return 1; else return a*p
2013-08-28 23:57:11
443
原创 奋战杭电ACM(DAY5)1009
又干了一题,今天感觉不错呀!再接再厉!晚上继续!!不知不觉原来用到了昨天看的贪心算法~~~用了才知道这个算法就是贪心,看来还不熟练,继续加油练习!!FatMouse' Trade#include #include using namespace std;int main(){ int M,N,i,k; double javabean,tmp; while(c
2013-08-28 19:36:30
527
原创 奋战杭电ACM(DAY5)1008
被前两题虐身虐心后看到这题简直难以置信,怎么可以这么水!!一次AC不解释!!难道老师是故意放这么道水题来安慰我们受伤的小心灵??Elevator#include using namespace std;int main(){ int N,i,time; while(cin >> N) { if(N==0) bre
2013-08-28 16:07:15
525
转载 ACM必备(学完一个就加亮一个)
今天在新浪博客上看到了这篇文章,深感压力,转过来,我也要开始学啦!___________________________________________________________________________________________________________________________________时间复杂度(渐近时间复杂度的严格定义,NP问题,时间复杂
2013-08-27 13:30:15
1556
1
原创 奋战杭电ACM(DAY4)1005
今天AC两道啊啊啊啊啊!!被这题虐死了啊啊啊啊!!先是直接递归,溢出,就知道没这么简单……后来发现了循环,结果n类型写错,数组下标溢出,忘记跳出循环,循环节长度求错……我勒个去的26号的题拖到现在啊啊啊啊啊!!!终于AC了……纪念一下……动态建表,学到啦!!!Number Sequence#include using namespace std;int main(){
2013-08-27 02:40:09
431
原创 奋战杭电ACM(DAY3)1004
这道题好简单,没用任何算法直接做了……方法很笨,不过稳扎稳打一次AC!再搜一搜有没有很巧妙的解法!Let the Balloon Rise#include #include using namespace std;int main(){ int nmax,N,j,i; string max; nmax=0; while(cin >> N)
2013-08-26 12:47:07
417
原创 奋战杭电ACM(DAY2)1003
第一道动态规划题,好有成就感,哈哈!Max Sum#include using namespace std;int main(){ int T,N,i,num,sum,temp,begin,end,max,n; n=0; cin >> T; while(T>=1) { sum=0; max=-1001; begin=1; temp=1; end
2013-08-25 09:04:19
434
原创 奋战杭电ACM(DAY1)
今天开始刷杭电ACM的题库,我是一只小笨鸟,只有勤奋才能飞得高,前辈的指点少而精,我会全部做到! 今天刷了4道题……是不是很少……不过我会努力的,赶上赶上!Problem-1000:A + B Problem#include using namespace std;void main(){ int a,b; while(cin >> a >> b)
2013-08-24 22:35:54
471
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人