2014年2月13日
摘要: 原题链接简单题。附ac代码:#include #include #define MAX 101char BUF[MAX];int main(){ int z, o, j, len, lens; while(scanf("%s", BUF), BUF[0] != 'E'){ z = o = j = 0; lens = len = strlen(BUF); while(len--){ switch(BUF[len]){ case 'Z': ++z; break; case 'O': ++o; break; case 'J& 阅读全文
posted @ 2014-02-13 14:37 长木Qiu 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。附ac代码:#include int f(int n){ if(n & 1) return (n * 3 + 1) / 2; return n / 2; }int main(){ int n, count; while(scanf("%d", &n), n){ count = 0; while(n != 1){ n = f(n); ++count; } printf("%d\n", count); } return 0;} 阅读全文
posted @ 2014-02-13 14:15 长木Qiu 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。附ac代码:#include int main(){ int t, n, s, i, v; scanf("%d", &t); while(t-- && scanf("%d", &n)){ s = 0; v = 1; i = 1; while(i = 10000) s %= 10000; } printf("%d\n", s); } return 0;} 阅读全文
posted @ 2014-02-13 13:51 长木Qiu 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 原题链接考察递推关系,a[i].cas = a[i-1].cas *2; a[i].num = a[i-1].num * 2 - a[i-1].cas + a[i].cas;附ac代码:#include struct Node{ long long cas; long long num;};int main(){ int t, n, s, i; Node a[21]; a[0].cas = a[0].num = 0; a[1].cas = a[1].num = 1; a[2].cas = 2; a[2].num = 3; for(i = 3; i != 21; ++i){ a[i].c... 阅读全文
posted @ 2014-02-13 13:40 长木Qiu 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。注意看清题意。附ac代码:#include long long jie(int n){ long long s = 1; for(int i = 2; i <= n; ++i) s *= i; return s;}int main(){ int t, n, i, sign; long long s, a[21]; for(i = 1; i != 21; ++i) a[i] = jie(i); scanf("%d", &t); while(t-- && scanf("%d", &n)){ s = 1; 阅读全文
posted @ 2014-02-13 12:06 长木Qiu 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。附ac代码:#include #include #include #include #define MAX 1000 + 2char S[MAX];char Alp[MAX];char Dig[MAX];int cmp(const void *a, const void *b){ return *(char *)b - *(char *)a;}int main(){ int t, alp, dig, len, i; scanf("%d", &t); while(t-- && scanf("%s", S)){ mem 阅读全文
posted @ 2014-02-13 11:46 长木Qiu 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。附ac代码:#include int main(){ int n; double x, s; while(scanf("%lf", &x), x){ s = 0; n = 1; while(s < x) s += 1.0 / ++n; printf("%d card(s)\n", n - 1); } return 0;} 阅读全文
posted @ 2014-02-13 11:22 长木Qiu 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。附ac代码:#include #include int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b;}int main(){ int a[15], t, n; scanf("%d", &t); while(t-- && scanf("%d", &n)){ for(int i = 0; i != n; ++i) scanf("%d", &a[i]); qsort(a, n, sizeof(int), 阅读全文
posted @ 2014-02-13 11:08 长木Qiu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 原题链接简单题。附ac代码:#include #include int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b;}int main(){ int t, n, *a, *b, score; scanf("%d", &t); while(t-- && scanf("%d", &n)){ a = (int *)malloc(sizeof(int) * n); b = (int *)malloc(sizeof(int) * n); for(in 阅读全文
posted @ 2014-02-13 10:56 长木Qiu 阅读(158) 评论(0) 推荐(0) 编辑
  2014年2月12日
摘要: 原题链接二元一次方程 a*x+b*y=n,n为a,b的最大公约数的整数倍即有解附ac代码:#include int main(){ int t, a, b, n, x; scanf("%d", &t); while(t-- && scanf("%d%d%d", &a, &b, &n)){ while(b){ x = a % b; a = b; b = x; } if(n % a) printf("No\n"); else printf("Yes\n"); } retu 阅读全文
posted @ 2014-02-12 23:44 长木Qiu 阅读(116) 评论(0) 推荐(0) 编辑