现在的位置: 首页
3℃

头文件

2012年03月16日 模板  ⁄ 被围观 203+
/* ID:shiryuw1 PROG: LANG:C++ */ #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> using namespace std; #define zero(a) memset(a,0,sizeof(a)) #define one(a) memset(a,1,sizeof(a)) #define fone(a) memset(a,-1,sizeof(a)) #define pow2(a) ((a)*(a)) #define pow3(a) ((pow2(a))*(a)) int main() { // freopen(".in","r",stdin); // freopen(".out","w&q...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

1℃

ACM Recent Contests

2012年04月25日 比赛  ⁄ 被围观 167+
flash来源:http://acm.llvsi.com/wp-content/uploads/2012/04/contest.swf 其他比赛公告版本: 南开版本:http://acm.nankai.edu.cn/recent_contests.php acmicpc信息站版本:http://acmicpc.info/archives/224 杭电版本:http://acm.hdu.edu.cn/recentcontest/ 添加到谷歌日历(作者:Philo Yang):http://goo.gl/OBaEl 手机客户端下载(下载地址来自于acmicpc信息站): Android版:http://contests.acmicpc.info/RecentContest_beta.apk Windows Phone版:http://contests.acmicpc.info/RecentContest.xap
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (1 votes, average: 5.00 out of 5)
Loading ... Loading ...
0℃

USACO3.2.2 Stringsobits 解题报告

2012年05月14日 USACO  ⁄ 被围观 39+
组合数学,比较简单的一题,详细看代码,注意要用无符号数或者64位整数 /* ID:shiryuw1 PROG:kimbits LANG:C++ */ #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> using namespace std; #define zero(a) memset(a,0,sizeof(a)) #define one(a) memset(a,1,sizeof(a)) #define fone(a) memset(a,-1,sizeof(a)) #define pow2(a) ((a)*(a)) #define pow3(a) ((pow2(a))*(a)) long long c[50][50]; int ...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (1 votes, average: 5.00 out of 5)
Loading ... Loading ...
0℃

USACO3.1.5 Contact 解题报告

2012年05月10日 USACO  ⁄ 被围观 31+
USACO卡题有一段时间了,没想到今天连A三题,看来有进步了????不过,马上要数据库考试了,美国奶牛3.2要暂停了 这题做好很简单,但是输入输出不好处理,输入我是通过 while(~scanf("%s",s+strlen(s))); 来处理的,但是在输出上wa了几次,主要是那个回车和空格的处理,还有输出六个的问题 这题可以用map来做,每次取出s中长度a~b的一段给map中,并计数+1,最后再排序,对排序的问题不怎么会用,我是再从考一个pair数组给解决的,C++的STL不是很熟,详看代码 /* ID:shiryuw1 PROG:contact LANG:C++ ...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (1 votes, average: 1.00 out of 5)
Loading ... Loading ...
0℃

USACO3.1.6 Stamps(动态规划)解题报告

2012年05月10日 USACO  ⁄ 被围观 33+
题目大意很简单,就是给出n中邮票的价值,求从 1 分开始连续的可用集合中不多于 K 张邮票贴出的邮资数。就是一个背包问题, 用dp[i]表示贴出价值为i的邮资所用的最少的邮票数,可得转移方程 dp[i]=max(dp[i-a[x]]+1,dp[i]) 其中a[x]为给出的n张邮票中的一种 最后,就顺序遍历dp数组,找出中断点。没什么难度 /* ID:shiryuw1 PROG:stamps LANG:C++ */ #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> u...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (1 votes, average: 5.00 out of 5)
Loading ... Loading ...
0℃

USACO3.1.4 Shaping Regions 搜索+矩形切割

2012年05月10日 USACO  ⁄ 被围观 23+
好久没做USACO了,都是因为这题,矩形切割之前完全不会,但看了04年薛矛的论文《解决动态统计问题的两把利刃——剖析线段树与矩形切割》 顺利1A,关于矩形切割部分,他的论文讲的很仔细,推荐去看看 下面部分引用自薛矛的论文 矩形集合中已有矩形(x1,y1,x2,y2),现加入矩形(x3,y3,x4,y4)。它们的位置关系可以有很多种(有17种之多),这里就不一一列举了。但无论它们的位置关系如何复杂,运用线段切割的思想来进行矩形切割,就会变得十分明了。我们将矩形的切割正交分解,先进行x方向上的切割,再进行y方向的切割。如...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (1 votes, average: 3.00 out of 5)
Loading ... Loading ...
0℃

poj1458 最长公共子序列问题

2012年05月09日 POJ  ⁄ 被围观 35+
杭电挂了,状态dp完全没看懂,只有秒一道水题充数,dp还要加油啊 import java.util.*; public class Main { public static void main(String[] args) { int[][] dp=null; String s1=new String(); String s2=new String(); Scanner in=new Scanner(System.in); while(in.hasNext()){ s1=in.next(); s2=in.next(); dp=new int[s1.length()+1][s2.length()+1]; for(int i=0;i<s1.length();i++){ for(int j=0;j<s2.length();j++){ if(s1.charAt(i)==s2.charAt(j)) dp[i...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (No Ratings Yet)
Loading ... Loading ...
0℃

POJ1390 Blocks 常见动态规划模型

2012年05月08日 POJ  ⁄ 被围观 34+
黑书真不是盖的!lrj黑书的常见模型分析的第一道例题(P123) 题目大意黑书上都有,但分析初看时没看懂,等到wa了几次才明白,因为合并的区间段有可能来自不同的区域,所以这个若干段不好处理。 #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> using namespace std; #define zero(a) memset(a,0,sizeof(a)) #define one(a) memset(a,1,sizeof(a)) #define fone(a) memset(a,-1,sizeof(a)) struct pro...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (No Ratings Yet)
Loading ... Loading ...
0℃

Codeforces Round #118 (Div. 2) :D. Mushroom Scientists

2012年05月05日 Codeforces  ⁄ 被围观 64+
题目就是给出a b c和S,求出一组非负数x y z 使得x+y+z=S,并且要求x^a*y^b*z^c最大 有公式,可以直接套用 但要注意a=b=c=0的情况,要特殊处理,否则当x=s*a/(a+b+c) y=s*b/(a+b+c) z=s*c/(a+b+c)时x^a*y^b*z^c最大 可以证明,此处证明略,有兴趣的可以参考这篇文章 #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> using namespace std; #define zero(a) memset(a,0,sizeof(a)) #define one(a) memset...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (No Ratings Yet)
Loading ... Loading ...
0℃

Codeforces Round #118 (Div. 2) :C. Plant

2012年05月05日 Codeforces  ⁄ 被围观 55+
就是求第n个图形的上三角的个数 设f[n]为第n个图形的上三角的个数 g[n]为第n个图形的下三角的个数 则有 f[n]=3*f[n-1]+g[n-1];       g[n]=3*g[n-1]+f[n-1]; 则可以构造矩阵 用矩阵快速幂解决 #include<iostream> #include<cstdlib> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; struct prog { __int64 a[2][2] ; void init(){ a[0][0]=a[1][1]=3; ...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (No Ratings Yet)
Loading ... Loading ...
0℃

Codeforces Round #118 (Div. 2) :B. Growing Mushrooms

2012年05月05日 Codeforces  ⁄ 被围观 39+
水题,就是对每组的max(a*t1*(100-k)/100.0+b*t2*1.0,b*t1*(100-k)/100.0+a*t2*1.0)排序,如果相等,再让序号排 #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> using namespace std; #define zero(a) memset(a,0,sizeof(a)) #define one(a) memset(a,1,sizeof(a)) #define fone(a) memset(a,-1,sizeof(a)) struct prog{ int k; double high; }ans[1005]; bool cmp(prog a,prog b) { if(a.high==...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (No Ratings Yet)
Loading ... Loading ...
0℃

Codeforces Round #118 (Div. 2) :A. Comparing Strings

2012年05月05日 Codeforces  ⁄ 被围观 33+
晕死,纯水题,竟然在最后给挂了! #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <cstdio> #include <cmath> using namespace std; #define zero(a) memset(a,0,sizeof(a)) #define one(a) memset(a,1,sizeof(a)) #define fone(a) memset(a,-1,sizeof(a)) char s1[100005]; char s2[100005]; int main() { while(~scanf("%s%s",s1,s2)) { int wrong=0; found=false; if(strlen(s1)!=strlen(s2)) { co...
阅读全文
Wrong AnswerCompilation ErrorCompilingJudging & RunningAccepted (No Ratings Yet)
Loading ... Loading ...