上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=3刚开始的时候自己没想到,然后看大牛的题解。一直不懂的是为什么大牛用两个点就可以求出面积来。问了明智,知道了原来是因为所有的面积的计算表达式的展开会消去相同的项,然后就两个点表示就可以了。大牛的日志:http://blog.csdn.net/niushuai666/article/details/7454078View Code 1 #include <stdio.h> 2 #include <math.h> 3 #include <iostream> 4 #i 阅读全文
posted @ 2012-09-17 10:59 YORU 阅读(721) 评论(0) 推荐(0)
摘要: http://codeforces.com/problemset/problem/224/B暴力View Code 1 #include <iostream> 2 using namespace std; 3 const int maxn=100005; 4 bool f[maxn]; 5 int ans[maxn],s[maxn]; 6 int main() 7 { 8 int n,k,i,j,mark; 9 cin>>n>>k;10 {11 mark=-1;12 for(i=0;i<n;i++)13 {14 ... 阅读全文
posted @ 2012-09-17 09:54 YORU 阅读(200) 评论(0) 推荐(0)
摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=63数据结构。View Code 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int n,m,i,j; 6 while(cin>>n>>m,n||m) 7 { 8 j=1; 9 for(i=0;i<n;i++)10 {11 if(m%2)12 {13 j=j*2;... 阅读全文
posted @ 2012-09-17 09:03 YORU 阅读(153) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2352刚开始想对二维的是怎么更新的, 后来才知道原来Y轴是递增.也就是对同一个点来说, 每次Y增加的都是这个这个点现在的层数的下一层.然后想, 如果它在当前点的X又点了一下,按照题意,相当于在同一点点了连续点了两下.其实每次更新一层...Y表示层数View Code 1 #include <iostream> 2 using namespace std; 3 const int maxn=60000; 4 int ans[maxn]; 5 int stars[maxn]; 6 int lowbit(int x) 7 { 8 re 阅读全文
posted @ 2012-09-15 20:57 YORU 阅读(272) 评论(0) 推荐(0)
摘要: View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define m 10 4 #define M 20 5 int gcd(int a, int b) 6 { 7 return !b?a:gcd(b,a%b); 8 } 9 int main()10 {11 char s1[m],s[M],s2[M],c;12 int a,b,k,i,len,t=0;13 while(~scanf("%s%s%ld%s%s",s,s1,&b,s2,s2))14 {15 t++;16 ... 阅读全文
posted @ 2012-09-15 15:57 YORU 阅读(158) 评论(0) 推荐(0)
摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=45刚开始没注意,是大数....View Code 1 #include <stdio.h> 2 #include <string.h> 3 int ans[102][61]; 4 int main() 5 { 6 int i,j,n,t,k; 7 memset(ans,0,sizeof(ans)); 8 ans[1][0]=4; 9 for(i=2;i<102;i++)10 {11 k=0;12 for(j=0;j<61;... 阅读全文
posted @ 2012-09-14 16:23 YORU 阅读(217) 评论(0) 推荐(0)
摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=90今天开始上算法课了,这是今天老师将的书本上的递归的内容。View Code 1 #include <iostream> 2 using namespace std; 3 int f(int n,int m) 4 { 5 if(n<1 || m<1) return 0; 6 if(n==1 || m==1) return 1; 7 if(n == m) return f(n,n-1)+1; 8 if(m > n) return f(n,n); 9 ret... 阅读全文
posted @ 2012-09-12 21:10 YORU 阅读(211) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4350取余。举例子 3 31 2 3 4 5 1 2 3 4 5 1 2 3 4 5.1 2 3 4 5 1 2 3 4 5 1 2 3 4 5.由图可以看出,取的恰好是N个(L-R+1)的长度,然后就可以取余可以求得现在相对于R位置的位置。View Code 1 #include <stdio.h> 2 #define maxn 52 3 int ans[maxn]; 4 int main() 5 { 6 long t,n,l,r,d=0,i,j,mark; 7 scanf("%ld& 阅读全文
posted @ 2012-09-11 21:12 YORU 阅读(202) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4287MAP 无压力.View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <map> 4 #include <string.h> 5 using namespace std; 6 int main() 7 { 8 int t,n,m,i,j,num; 9 long ans[5005],sum,k;10 char str[7];11 int character[26]={2,2,2,3,3, 阅读全文
posted @ 2012-09-10 19:45 YORU 阅读(175) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4278进制转换,以前看过一道十进制转换为十三进制的,现在忘记哪里做过了0 1 2 3 4 5 6 7 8 9 十进制0 1 2 3 4 5 6 7 八进制View Code 1 #include <stdio.h> 2 #include <string.h> 3 int main() 4 { 5 long a[10]={0,1,2,0,3,4,5,6,0,7},i,j,sum,k; 6 char s[100]; 7 while(~scanf("%s",&s) 阅读全文
posted @ 2012-09-10 19:16 YORU 阅读(123) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页