ACM 水题之路
huixisheng
无所谓结果如何,只要一直坚持并努力就好!!
展开
-
shǎ崽 OrOrOrOrz hdu2673
#include#include#includeusing namespace std;const int MAX=10001;int a[MAX];int main(){ int n, i; while(scanf("%d", &n)!=EOF) { for(i = 0; i scanf("%d", &a[i]); sort(a,a+n); //for(i = 0; i // pr原创 2010-03-21 11:32:00 · 619 阅读 · 0 评论 -
1178 hdu Heritage from father
<br />//log10 函数的应用<br />// 1 + 1 + 2 + 1 + 2 + 3 + 1 + 2 + 3 + 4 + ... = n * (n + 1 ) * (n + 2) / 6<br />#include<iostream>//2549280 2010-06-19 23:47:18 Accepted 1178 0MS 320K 288 B C++ 悔惜晟 <br />#include<cmath><br />using namespace std;<br />int main()<b原创 2010-06-28 22:43:00 · 492 阅读 · 2 评论 -
Tju 3497 3495 (集训第一场练习赛)
/*3497. The job of Mike's mother --------------------------------------------------------------------------------Time Limit: 1.0 Seconds Memory Limit: 65536KTotal Runs: 194 Accepted Runs: 55------------------------------------------------------------原创 2010-07-04 15:59:00 · 469 阅读 · 0 评论 -
Manipulating the Power Square hdu2598(居然是题目看错了)
/* 终于AC了,看来我读题的能力还是很欠缺啊!! The command ”MOVE” is followed by one more more moves: If move attempts to swap 0 with a non-existent neighbor, then output ”FAILED” on a single line and stop attempting th原创 2010-05-16 11:32:00 · 364 阅读 · 0 评论 -
The Dreadful Seven hdu 2599 为何错啊 ?非常纠结的,难道测试数据里面没有ctrl + Z的。。
#include//这个就wrong ,想不明白为何。。。比赛的时候在这个题目悲剧了!! #include#includeusing namespace std;int dir[4][2] = {{-1 ,0}, {0, -1}, {0, 1}, {1 , 0}};int main(){ int n, i, j; char str[20]; int map[105][10原创 2010-05-16 09:51:00 · 520 阅读 · 0 评论 -
hdu 1431 素数回文
<br />/* 本题给的n的数据很大,但是n > N 的时候的数都是不成立 数论真的要好好的去学习*/#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;const int N = 10000000;bool hash[N];int path[1000000];int len;inline void Hash(){原创 2010-07-10 22:53:00 · 610 阅读 · 1 评论 -
hdu 3463Goldbach Division(打表法)
<br />在这里留下一个纪念!!<br /> <br />/* 这个题目应该是我代码写的最搓的了,但是还好AC了。刚学会了打表,AC了就好*/#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>using namespace std;const int N = 7801;bool prime[N];int sum[12209] = { 233,27575,80,1原创 2010-07-21 17:17:00 · 3148 阅读 · 0 评论 -
hdu 3477 Temperature
<br />/* 原来物理在ACM上也有应用的,有关积分的题目真的是几乎没有做过的 一直到比赛的最后才AC的,纠结的说 牛顿的冷却定理是参考了baidu的,确切的说不是评自己的水平AC的 以后看到非线性的方程要想到积分*/#include <iostream>#include <algorithm>#include <cmath>using namespace std;int main(){ int t; //freopen("hxsh.in", "r",原创 2010-07-23 00:04:00 · 726 阅读 · 0 评论 -
hdu 3469 Catching the Thief
<br />/* 为何比赛的时间就是想不到呢?还以为可以用2插排序树。。真的不知但是是怎么想的 其实模拟一下就可以出来的。。*/#include <iostream>using namespace std;int main(){ int t; cin >> t; for(int i = 1; i <= t; i++) { int n; cin >> n; cout << "Case " << i <<":"<< " "; if(n== 1原创 2010-07-23 09:23:00 · 592 阅读 · 0 评论 -
hdu 3497 Star Gazer
<br /><br />/* 说起这题真的会气死人的,物理到现在全忘了,什么叫干涉完全不知道,等于说这题根本没办法解 看了解题报告才知道,悲剧!!看来做ACM什么都要学好啊,上回也有一个物理的要积分的题目*/#include <iostream>#include <cstdio>#include <cmath>#define IP 3.1415926using namespace std;int main(){ double r, h; while( scan原创 2010-08-03 20:03:00 · 691 阅读 · 0 评论 -
sort 1425 hdu(hash 和 sort排序)
<br />// hash 真的不错的,省了几乎一半的时间<br />#include<iostream>//2551006 2010-06-20 22:39:00 Accepted 1425 312MS 1212K 521 B C++ 悔惜晟 <br />#include<cstdio><br />#include<cstring><br />using namespace std;<br />bool hash[1000000];<br />int main()<br />{<br /> int n,原创 2010-06-20 23:05:00 · 525 阅读 · 0 评论 -
Flying to the Mars (hash) 1800 hdu
<br />/*<br /> 参考课件写的程序都有那么多的错误,悲剧了<br /> http://acm.hdu.edu.cn/forum/read.php?tid=7329<br /> http://hi.baidu.com/heiyeshuwu/blog/item/3853baa1ed68b488471064b4.html<br /> http://acm.hdu.edu.cn/forum/read.php?tid=6567<br /> 除去马甲,本题的本质是——求相同级别(level)的人最多是几个。原创 2010-06-21 00:44:00 · 413 阅读 · 0 评论 -
前m大的数 hdu1280 (hash)
<br />//强大的hash 时间相差好多啊!!<br />#include<iostream>//2551148 2010-06-21 00:59:31 Accepted 1280 15MS 288K 843 B C++ 悔惜晟 <br />#include<cstdio><br />using namespace std;<br />int hash[10001];<br />int a[3005];<br />int main()<br />{<br /> int n, m;<br /> while原创 2010-06-21 01:17:00 · 410 阅读 · 0 评论 -
进制转换 2031 直接调用stack
//第一次调用栈,突然发现这是一个好东西 #include#include#includeusing namespace std;//int num[100001];int main(){ int n, r; while(cin>>n>>r) { if(n { printf("-"); n = -n; } stack q; //q.base() = 0; //q.to原创 2010-04-22 15:23:00 · 402 阅读 · 0 评论 -
Circle ZOj3321
/*不知为何比赛的时候就是做不出来,思路真的很清晰地。求一个回路,没有多余的边Circle--------------------------------------------------------------------------------Time Limit: 1 Second Memory Limit: 32768 KB --------------------原创 2010-04-10 21:54:00 · 763 阅读 · 11 评论 -
IP的计算 hdu2206
http://acm.hdu.edu.cn/showproblem.php?pid=2206//在wrong 10次后终于AC//为何简单的题目要考虑这么久? #include//2265653 2010-03-29 21:34:12 Accepted 2206 0MS 228K 1452 B C++ 悔惜晟 #include#includeusing namespace std;int ma原创 2010-03-29 21:55:00 · 579 阅读 · 0 评论 -
Clock ZOJ 3313
/*Clock--------------------------------------------------------------------------------Time Limit: 1 Second Memory Limit: 32768 KB ----------------------------------------------------------原创 2010-04-10 22:51:00 · 1120 阅读 · 0 评论 -
hdu 1141 Factstone Benchmark
//很简单的题,就是n!//一开始题目读不懂,baidu了才知道题目的意思,题目很简单,只是题目的意思很难读懂//2268208 2010-03-30 17:32:13 Accepted 1141 281MS 312K 285 B C++ 悔惜晟 #include#includeusing namespace std;int main(){ int y, i; long long int a;/原创 2010-03-30 17:39:00 · 446 阅读 · 0 评论 -
排名 hdu1236
#include//2272775 2010-03-31 18:27:45 Accepted 1236 78MS 276K 919 B C++ 悔惜晟 #include#include#includeusing namespace std;struct stu{ char name[25]; int chengji; int num; //int b[11];}df[1005];int c原创 2010-03-31 18:30:00 · 342 阅读 · 0 评论 -
前m大的数 hdu1280
#include//2272848 2010-03-31 18:44:28 Accepted 1280 656MS 17868K 609 B C++ 悔惜晟 #include#includeusing namespace std;const int MAX = 4498501;struct stu{ int sum;}df[MAX];int cmp(stu a, stu b){ retur原创 2010-03-31 18:45:00 · 453 阅读 · 0 评论 -
ZOJ_2004 2104Let the Balloon Rise
/* 第一回交的时候居然错了Let the Balloon Rise--------------------------------------------------------------------------------Time Limit: 1 Second Memory Limit: 32768 KB -------------------------------原创 2010-04-12 19:34:00 · 388 阅读 · 0 评论 -
hdu 1284钱币兑换问题(神奇)
/*(很神奇的题目)一开始我以为是母函数的问题,的确用母函数可以解,可是铁定超时,后来baidu后发现如下解法#include#includeusing namespace std;int a[32768];int main(){ int n,i; a[0]=0; for( i = 1 ; i { if(i%6==1&&i!=1) a[i]=a[i-1]+(i/6); else原创 2010-04-13 20:18:00 · 1085 阅读 · 0 评论 -
愚人节的礼物 hdu1870
#include//2276135 2010-03-31 22:57:01 Accepted 1870 0MS 272K 644 B C++ 悔惜晟 #include//假设放礼物的盒子里不再放其他盒子。 特别注意这句话!!!using namespace std;//虽然是栈,但是完全不要用栈,只是用了栈的背景知识const int MAX = 1005;struct stack{ char a原创 2010-03-31 22:59:00 · 414 阅读 · 0 评论 -
Equations hdu1496(hash)
//一开始写的实话就感觉会超时,结构真的TLE。呵呵,一开始的想法太过简单,后来参考某大牛的代码之后终于AC#include//2337619 2010-04-13 22:44:10 Accepted 1496 218MS 8128K 797 B C++ 悔惜晟 #include#includeusing namespace std;int hash1[1000001];i原创 2010-04-14 16:27:00 · 395 阅读 · 0 评论 -
What day is it hdu2133(终于AC)
//#include#include//2348036 2010-04-16 14:16:54 Accepted 2133 15MS 232K 1474 B C++ 悔惜晟 #includeusing namespace std;char s[7][11]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturda原创 2010-04-16 14:20:00 · 554 阅读 · 0 评论 -
hdu 1597(浓缩的情感)
/*第二次做这个题目的时候,终于发现题目很水,第一回做的时候超时了,在原来超时的代码上有很大的改进但是效率还是不怎么高,突然感觉数学对于ACM有很大的用处感觉因为ACM日子过的很充实,我也不知做这个对未来有没有帮助,但是我明显的感觉到我编程的能力增强了跟着钟超和张尔东真的学到了好多,特别是分析问题的能力,分析问题的方法,跟他们之间的差距我该用我的努力去弥补,至于明天的省赛,我想我真的尽力,不管结果原创 2010-04-16 15:19:00 · 784 阅读 · 2 评论 -
1200 hdu
#include//2303924 2010-04-06 21:34:08 Accepted 1200 0MS 288K 440 B C++ 悔惜晟 #include//很简单的题目,读懂就OK了#includeusing namespace std;int main(){ char str1[250]; int n, len; while(cin>>n && n) { cin>>str1;原创 2010-04-06 23:03:00 · 338 阅读 · 0 评论 -
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3403
<br />/* 这样的水题把我卡的好惨的,看来不够细心啊 */ #include <iostream>#include <cstdio>#include <cmath>typedef long long LL;using namespace std;const long long year = 18382;//LL ye[] = {1, 9, 36, 100, 225, 441, 784, 1296, 2025, 3025, 4356, 6084};int mon[原创 2010-09-04 23:58:00 · 1122 阅读 · 0 评论