上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页
  2014年2月28日
摘要: 原题链接这题难在找到题中隐含的递推关系,假设当n = k的时候有s中情况,那么当n = k + 1时,若新增加的一元钱化成两张5角,那么一共有s种情况,再把其中的一张5角化掉,增加(n * 10 - 5)/ 2 +1种情况,再化掉剩下的一张5角,增加(n*10/2)+1种情况,整理可得n = k + 1时,结果为s +(n * 10 - 5)/ 2 +1 +(n*10/2)+1 = s + n * 10 - 1种情况,递推关系出来了,剩下的就好办了。直接打表。#include int a[101] = {0, 10};int main(){ int t, n; for(n = 2; n != 阅读全文
posted @ 2014-02-28 23:30 长木Qiu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 原题链接这题很简单,但是做得我想哭%>_#include char *a[] = {"one", "two", "three"}, str[6];int cmp(char s[]){ int count = 0, len = strlen(str); for(int i = 0; i != len; ++i) if(s[i] != str[i]) ++count; return count;}int main(){ int t, i, x; scanf("%d", &t); while(t-- &am 阅读全文
posted @ 2014-02-28 22:45 长木Qiu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 原题链接在没有更好的方法前,最笨的方法就是最好的方法。#include #include int cmp(const void *a, const void *b){ int aa = *(int *)a, bb = *(int *)b; int i = 0, j = 0; while(aa){ i = i * 10 + aa % 10; aa /= 10; } while(bb){ j = j * 10 + bb % 10; bb /= 10; } return i - j;}int main(){ int t, a, b, *vec; scanf("%d", & 阅读全文
posted @ 2014-02-28 19:39 长木Qiu 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 原题链接险过代码:#include #define MAX 1000000 + 2int a[MAX] = {0, 1, 2};bool Judge(int n){ while(n){ if(n % 10) { n /= 10; continue; } return false; } return true;}int main(){ int n, i; for(i = 3; i != MAX; ++i) if(Judge(i)) a[i] = a[i - 1] + 1; else a[i] = a[i - 1]; while(scanf("%d", &n) == 1 阅读全文
posted @ 2014-02-28 16:03 长木Qiu 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 原题链接还以为要用什么数学技巧否则会超时呢,结果没想到可以直接暴力求解。。#include #define mod 1314520int f[270] = {1, 1};int main(){ int n, a, b; for(n = 2; n != 270; ++n) f[n] = (f[n - 1] + f[n - 2]) % mod; while(scanf("%d", &n) == 1){ a = b = 0; while(n){ if(n & 1) ++a; else ++b; n >>= 1; } printf("%d\n& 阅读全文
posted @ 2014-02-28 15:22 长木Qiu 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 原题链接#include #include #include #include #include #define MAX 5000 + 2using namespace std;char s[MAX];int main(){ vector vec; int t; char *p; while(scanf("%s", s) == 1){ p = strtok(s, "5"); if(p == NULL){ printf("0\n"); continue; } while(p != NULL){ sscanf(p, "%d&qu 阅读全文
posted @ 2014-02-28 09:06 长木Qiu 阅读(98) 评论(0) 推荐(0) 编辑
  2014年2月27日
摘要: 原题链接很巧妙的一道题。我是没能想到这么巧的方法,唉,差距真不是那么一点点啊...附原题标程: #include#define N 1000010int ans[N]={0},a;void prime(){ int i,j,x=0; for( i=2; i#define MAX 1000000 + 2int a[MAX];void Count(){ for(int i = 2, count = 0; i < MAX; ++i){ if(!a[i]){ ++count; for(int j = i; j < MAX; j += i) a[j] = count; //... 阅读全文
posted @ 2014-02-27 17:09 长木Qiu 阅读(107) 评论(0) 推荐(0) 编辑
  2014年2月26日
摘要: 原题链接和HDOJ1753一样的题。#include #include #define MAX 400 + 10char a0[MAX], b0[MAX], s[MAX], aa[MAX], bb[MAX], ss0[MAX]; //aa保存整数,a保存小数int main(){ char *dot; while( scanf( "%s%s", a0, b0 ) == 2 ){ char *a = a0, *b = b0, *ss = ss0; aa[0] = bb[0] = '0'; //留着进位 dot = strchr( a, '... 阅读全文
posted @ 2014-02-26 17:05 长木Qiu 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 原题链接开始想得比较复杂,结果理不清思路,后来发现可以直接打表,然后就过了。#include #define MAX 50000 + 2int a[MAX];bool f(int n){ while(n){ if(n % 10 == 4) return 1; n /= 10; } return 0;}int main(){ int n; for(n = 1; n != MAX; ++n) if(f(n)) a[n] = a[n - 1]; else a[n] += a[n - 1] + 1; while(scanf("%d", &n) == 1) printf(&q 阅读全文
posted @ 2014-02-26 16:58 长木Qiu 阅读(127) 评论(0) 推荐(0) 编辑
  2014年2月25日
摘要: http://yunpan.cn/Q4w46b9XLTHz7 阅读全文
posted @ 2014-02-25 16:14 长木Qiu 阅读(97) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页