上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: 题目:Code Refactoring思路:直接暴力。。水题#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;bool is_ok(int a,int b,int c,int d){ if(a==b||b==c||a==c||a==d||b==d||c==d) return false; return true;}int main(){ int t; scanf(&q 阅读全文
posted @ 2013-06-20 18:53 over_flow 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目:Just the Facts思路:枚举10000素数内,各因子出现的次数,然后取模为10。因为0是由2和5构成的,所以2和5的幂单独讨论,同时由于2的幂肯定大于5的,所以我们最后要算的再乘上2的减去后的幂就可以得到。#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <iostream>using namespace std;const int maxn=10001;int n_prime=0;int prime[maxn 阅读全文
posted @ 2013-06-20 18:42 over_flow 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目:Light, more light思路:第一次做的时候是素数打表,然后分解质因式,求约数个数是不是奇数的,按理来说没错,但是就是过不了。发现的一个陷阱是2^32-1这个值肯定不能用int,还是找不到分解质因数做法的错 ==其实这个只要判断是不是完全平方数就ok了,不解释,自己看#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <iostream>using namespace std;int main(){ long l 阅读全文
posted @ 2013-06-20 15:12 over_flow 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目:Skew Binary思路:水题。。#include <cstring>#include <algorithm>#include <iostream>#include <cmath>#include <cstdio>using namespace std;int main(){ string s; while(cin>>s) { if(s=="0") break; long long ans=0; int x=1; for(int i=s.size()-1;i>=0;i--) {... 阅读全文
posted @ 2013-06-20 14:43 over_flow 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题目:跳舞毯思路:递归水题,n-1时,由B,C跳回A的种数是f(n-1),对于n-2的情况就是,选择B,C中一个点,跳过去,然后跳回A,因此种数是2*f(n-2) 所以 f(n)=f(n-1)+2*f(n-2)#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int f[1010];int main(){ f[0]=0; f[1]=0; f[2]=2; for(int 阅读全文
posted @ 2013-06-20 14:28 over_flow 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 题目:Dynamic Programming?思路:直接暴力。。水题#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <iostream>using namespace std;__int64 num[1010];int main(){ int t; scanf("%d",&t); for(int cases=1;cases<=t;cases++) { int n; scanf("% 阅读全文
posted @ 2013-06-20 14:12 over_flow 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 题目:统计问题思路:将问题转换成,前一状态是左或者右的,或者前的,设左右的那种是A(n-1),前的那种是B(n-1),那么对于当前的状态,如果现在往前B(n)=2*A(n-1)+B(n-1),如果往左:A(n)=A(n-1)+B(n-1) 往右的相同,那么对于这样的一个问题,可以构造矩阵或者求递推式,练下矩阵,所以写成构造矩阵的了#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <iostream>using namespac 阅读全文
posted @ 2013-06-20 10:34 over_flow 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目:67A - Partial Teacher思路:多写几组数据就可以找到规律了,就是要找到当前位置,往左往右的不完全连续L和R的最大长度#include <cstdio>#include <iostream>#include <cstring>#include <cmath>#include <algorithm>#include <queue>using namespace std;queue<int>q;int main(){ while(!q.empty()) q.pop(); int n; stri 阅读全文
posted @ 2013-06-19 20:47 over_flow 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题目:10361-Automatic Poetry思路:水题。。暴力#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;char str[110];string s[6];int main(){ int t; scanf("%d",&t); getchar(); while(t--) { gets(str); for(int i=0;i< 阅读全文
posted @ 2013-06-16 17:28 over_flow 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目:10010-Where's Waldorf?思路:水题。。暴力#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int row,col,l;char s[55][55];char str[110];int dir[8][2]={-1,1,0,1,1,1,-1,0,1,0,-1,-1,0,-1,1,-1};bool is_ok(int i,int j,in 阅读全文
posted @ 2013-06-16 16:48 over_flow 阅读(271) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页