程序片段(01):Test.c+NewTest.c

内容概要:题目测试

  1. ///Test.c
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #define r char S; T R; I N, G, s
  7. #define A(P,O) for(P=O; *P; P=U(P))
  8. typedef char T[128], *I, p[2400];
  9. #define memset (I)\
  10. memset
  11. void*P = strcpy; I Q(); typedef const void*f; int u(f P, f O){
  12. return strncmp((I)P, (I)O, 1);
  13. } T g, c = { 127 }; char l, F[6000000]; I U(I P){
  14. r; strncpy(R, P, 2);
  15. s = strchr(
  16. strcpy(P, c), 0)
  17. ; strncpy(P, R, 2); return s;
  18. } T q, B, E; I t(I P){
  19. r; qsort(P,
  20. strlen(P), 1, u);
  21. if (s = strstr(P, c))*s = 0; return P;
  22. } T a = { 2 }; void D(){
  23. r;
  24. S = 1; strcpy(R, c); t(F);
  25. for (; memset(E, S, l),
  26. (S = strlen(
  27. strcat(R, c))) < *R; t(s))for (s = B;
  28. N = strstr(F, E); s = F)
  29. * memset(N, *c, l) = S;
  30. } p H = "(*&,.", k; I j(I P){
  31. r = (I)malloc(
  32. strlen(
  33. strcat(P, "\177 ")));
  34. *strstr(P, c) = 0;
  35. return strcpy(s, P);
  36. } int K(f P, f O){ return u(O, P); } void
  37. b(){
  38. qsort(F,
  39. strlen(F), 1, K);
  40. } void n(I P){
  41. r; A(P, P){
  42. if (N = strchr(F, *P)); else{
  43. t(F);
  44. b(); memset(B, l, *F); N = F;
  45. while (*strrchr(B, l) = 0,
  46. *P <= (S = strlen(B))){
  47. *memset(E, S, l)
  48. = *c; strcat(F, E);
  49. } memset(B, 0, S);
  50. } *N = *c;
  51. } D();
  52. } void C(I P, I O){
  53. r; A(P, P)A(s, O){
  54. *strrchr(
  55. memset(
  56. strchr(
  57. memset(
  58. strncpy(k, B, 254), l, *P), 0), l, *s), l) = 0;
  59. *q = strlen(k)
  60. ; strcat(F, q);
  61. } D();
  62. } T i = "\13<\f="; void o(I P){
  63. A(P, P){
  64. *strrchr(
  65. memset(B, *c, *P), *c)
  66. = 0; memset(B, 0,
  67. *P = strlen(B));
  68. }
  69. } int V(f P, f O){ return u(*(I*)P, *(I*)O); } void e(I O){
  70. r; strcpy(H, O)
  71. ; strcpy(R, c); for (;
  72. 0 < strncmp(F, H, 1)
  73. ; strcat(R, c))A(s,
  74. H) memset(B, 0,
  75. *s = strlen(
  76. strcat(
  77. memset(B, *c, *s), c))); *k = 0; do{
  78. while
  79. (0 <= strcmp(F, H)){
  80. n(H); b();
  81. *q = strlen(R)
  82. ; strcat(k, q);
  83. }
  84. *strrchr(R, *c) = *B; o(H);
  85. } while (*R);
  86. } char d(I P){
  87. if (P = strstr(P, g)){
  88. if ((*g = getchar()) < *i)' ' < *g ? o(g) : d(" ");
  89. }
  90. else P = B; return*P;
  91. } I m(I
  92. P){
  93. qsort(P,
  94. strlen(P), 1, K); return*P == *c ? U(P) : P;
  95. } void J(I P){
  96. r = m(P);
  97. if (P < s) putchar('-')
  98. ; memset(B, l, *s); do{
  99. *E = *i;
  100. if (N = strchr(s,
  101. *q = strlen(B)))
  102. t(memset(
  103. memcpy(E, i, l), *c,
  104. strspn(N, q)))
  105. ; putchar(*E);
  106. *strrchr(B, *B = l) = 0;
  107. } while
  108. (*B); puts(B)
  109. ; free(P);
  110. } I M(){
  111. r = Q(), P, O; while (S = d(".)$")){
  112. N = Q();
  113. G = strcpy(F, B); P = m(s); O = m(N); if (S == ')'){ C(P, O); }
  114. else{
  115. strcpy(F, P); e(O); if (S == '.')G = k; else O = N;
  116. } free(s); G = j(G);
  117. s = strcat(G, P == s == (O == N) ? B : c)
  118. ; free(N);
  119. } return s;
  120. } I h(){
  121. r, P, O; for (N = M(); S = d("*,");
  122. N = strcat(s, S ? c : B)){
  123. G = M(); P = m(N); O = m(G); S = O == G == (S == ','); if (P == N == S)
  124. if (strcmp(P, O) < 0)
  125. {
  126. strcpy(F, O); n(P);
  127. }
  128. else{ strcpy(F, P); n(O); S = N < P; }
  129. else{
  130. strcat(
  131. strcpy(F, P), O); D();
  132. }
  133. s = j(F); free(N)
  134. ; free(G);
  135. } return N;
  136. } I Q(){
  137. r; if (S = d(","))
  138. if (N = strstr(s = Q(), c))*N = *B;
  139. else strcat(s, c); else if (d("'")){ s = h(); S = d("("); }
  140. else{
  141. strcpy(F, B); while (*q = d(i))
  142. {
  143. strcpy(H, F)
  144. ; memset(
  145. strncpy(F, B, l), S = 1,
  146. strcspn(i, q)); C(H, a);
  147. } s = j(F);
  148. } if (!S){
  149. o(strcpy(F, "tzouby!fssps"))
  150. ; puts(F);
  151. } return s;
  152. } int main1(int P, I*O)
  153. {
  154. qsort(O, P, sizeof*O, V);
  155. l = 1 < P ? strtol(*O, 0, l) : 10; C(H,
  156. i); strcpy(i, F); d(g); while (!d("\377"))for (J(h()); !d("\377\n"); d(g)); return 0;
  157. }
  1. ///NewTest.c
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <stdio.h>
  4. #include <stdlib.h >
  5. void main123()
  6. {
  7. /*int x, y;
  8. if (x < y)scanf("%d", &x); else scanf("%d", &y);*/
  9. //int i;
  10. //while (!scanf("%d", &i)) //!1
  11. // getchar();
  12. //abcde<回车>
  13. ////ch = getchar() //'a'
  14. //char ch;
  15. // //a ,b ,c d, e
  16. //while ((ch = getchar()) == 'e') //e e e
  17. //{
  18. // putchar(ch);
  19. // printf(" * ");
  20. //}
  21. //int x = 5, a = 0, b = 0;
  22. //if (x != (a + b)) printf("x=5\n");
  23. //else printf("a=b=0\n");
  24. //r ight ?
  25. //jhiu
  26. //char c;
  27. //c = getchar();
  28. //while ((c = getchar()) != '?')
  29. // putchar(++c);
  30. //int a, b, c, d, x;
  31. //a = c = 0;
  32. ////b = 1; d = 20;
  33. ////if (a)
  34. //// d = d - 10;
  35. ////else if (!b) //else if (if else配对)
  36. //// if (!c)x = 15;
  37. //// else x = 25;
  38. // switch (a)
  39. // {
  40. // case 2:
  41. // break;
  42. // }
  43. //
  44. //int a = 10;
  45. //int b = 20;
  46. //switch (1+a+b)
  47. //{
  48. //case 1:
  49. // break;
  50. //}
  51. //int n[2] = { 0 }, i, j, k = 2;
  52. //for (i = 0; i < k; i++)
  53. //for (j = 0; j < k; j++) n[j] = n[i] + 1;
  54. //printf("%d\n", n[k]);//n[2]
  55. //int i = 1, j = 1, k = 2;
  56. //j++ || ((k++) &&(i++));//短路效应
  57. ////1 + 3 * 4;
  58. //
  59. //printf("%d,%d,%d\n", i, j, k);
  60. //int a=10;
  61. //int c = 0;
  62. //switch (a)
  63. //{
  64. //case 2:
  65. // ;
  66. //}
  67. /*double sum = 0.0, x;
  68. for (x = 0.0; x < 3.0; x += 0.1)
  69. sum += x,printf("\n%f",x);
  70. printf("\n x=%f", x);*/
  71. //int a = 1;
  72. //int b = 10;
  73. //do
  74. //{
  75. // b -= a; //b=9,a=2 //b=6,a=3 //b=2,a=4 // b=-3 a=5
  76. // a++;
  77. //} while (b-- < 10);
  78. //printf("a=%d,b=%d", a, b);
  79. //system("pause");
  80. int i, j, k;
  81. for (i = 1; i <= 6; i++)
  82. {
  83. for (j = 1; j <= 20 - 2 * i; j++)
  84. printf(" ");
  85. for (k = 1; k <= i; k++)
  86. printf("%4d", i);
  87. printf("\n");
  88. }
  89. system("pause");
  90. }
  91. void main124()
  92. {
  93. char c;
  94. c = getchar();
  95. //switch必须快语
  96. switch (c)
  97. {
  98. case 0:case 1: printf("%d", c - '0'); break;
  99. default:putchar(c);
  100. }
  101. }
  102. void main125()
  103. {
  104. int a, b; char op;
  105. scanf("%d%d", &a, &b);
  106. scanf("%c", &op);
  107. switch (op)
  108. {
  109. case '+': printf("%d + %d = %d\n", a, b, a + b); break;
  110. case '-': printf("%d - %d = %d\n", a, b, a - b); break;
  111. default:printf(""); exit(1);
  112. }
  113. }
  114. void main126()
  115. {
  116. int n, i = 1; long sum = 0;
  117. printf("输入一个正整数:");
  118. scanf("%d", &n);
  119. while (i < n)
  120. i += 2;
  121. sum += i;
  122. if (n % 2 == 0) n--;
  123. printf("输出1+3+5+…+%d=%1d\n", n, sum);
  124. system("pause");
  125. }
  126. void main1215()
  127. {
  128. int s, t, a, b;
  129. scanf("%d,%d", &a, &b);
  130. //a=5//b=2
  131. s = 1;
  132. t = 1;
  133. if (a > 0) //作用范围最近的;如果整体的ifelse会嵌套
  134. {
  135. s = s + 1; /* ① */// s=2
  136. if (a > b)
  137. {
  138. t = s + t; /* ② */
  139. }
  140. else if (a == b)
  141. {
  142. t = 5;
  143. }
  144. else
  145. t = 2 * s;
  146. }
  147. printf("s=%d,t=%d\n", s, t);
  148. system("pause");
  149. }
  150. void main127()
  151. {
  152. int a, b, m, n;
  153. scanf("%d%d,\n", &a, &b);//a=1,b=0
  154. m = 1; n = 1;
  155. if (a > 0)
  156. {
  157. m = m + n; //1>0 m=2,n=1
  158. if (a < b)
  159. n = 2 * m;
  160. else if (a == b)
  161. n = 5;
  162. else
  163. n = m + 1;
  164. }
  165. printf("m=%d n=%d\n", m, n); //1,2
  166. system("pause");
  167. }
  168. void main128()
  169. {
  170. int s, t, a, b;
  171. scanf("%d,%d", &a, &b);//a=5//b=2
  172. s = 1;
  173. t = 1;
  174. //if作用范围只有一句大括号
  175. if (a > 0)
  176. s = s + 1; /* ① */
  177. if (a > b)
  178. t = s + t; /* ② */
  179. else if (a == b)
  180. t = 5;
  181. else
  182. t = 2 * s;
  183. printf("s=%d,t=%d\n", s, t);
  184. system("pause");
  185. }
  186. void main234()
  187. {
  188. int a, b, m, n;
  189. scanf("%d%d,\n", &a, &b);//a=1,b=0
  190. m = 1; n = 1;
  191. if (a > 0)
  192. m = m + n; //1>0 m=2,n=1
  193. //配对就近
  194. if (a < b)
  195. n = 2 * m;
  196. else if (a == b)
  197. n = 5;
  198. else
  199. n = m + 1;
  200. printf("m=%d n=%d\n", m, n); //1,2
  201. }

程序片段(02):递归.c

内容概要:转化递归

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. //01.编写程序,求a+aa+aaa+...(n个)aaa,其中a是一个数字.例如:3+33+333+3333+33333.
  4. // 1.分析问题步骤:
  5. // (1).复杂问题简单化
  6. // (2).复杂问题规律化
  7. // (3).复杂问题重复化
  8. //
  9. // 2.递归所能解决的问题:
  10. // 重复问题
  11. // 递推关系
  12. // 关系一:
  13. // 1--->3
  14. // 2--->33
  15. // 3--->333
  16. // n--->(n个)3-->((n-1)个)3*10+3
  17. int nAN(int num, int ele)
  18. {
  19. if (1 == num)
  20. return ele;
  21. return nAN(num - 1, ele) * 10 + ele;
  22. }
  23. // 关系二:
  24. // 1-->3
  25. // 2-->3+33
  26. // 3-->3+33+333
  27. // n-->n个整数,n个元素组成最大的数
  28. // Sn-->Sn-1+an
  29. int qNH(int num, int ele)
  30. {
  31. if (1 == num)
  32. return ele;
  33. return qNH(num - 1, ele) + nAN(num, ele);
  34. }
  35. int main(void)
  36. {
  37. //printf("%d \n", nAN(5, 3));
  38. //printf("%d \n", qNH(4, 1));
  39. system("pause");
  40. }
  41. //void digui3(int n, int a, int sum, int an)
  42. //{
  43. // if (n == 0)
  44. // {
  45. // printf("%d\n", sum);
  46. // return;
  47. // }
  48. // else
  49. // {
  50. // an = an * 10;
  51. // an += a;
  52. // sum += an;
  53. // digui3(n - 1, a, sum, an);
  54. // }
  55. //}

20160131.CCPP体系详解(0010天)的更多相关文章

  1. 20160129.CCPP体系详解(0008天)

    程序片段(01):函数.c+call.c+测试.cpp 内容概要:函数 ///函数.c #include <stdio.h> #include <stdlib.h> //01. ...

  2. 20160226.CCPP体系详解(0036天)

    程序片段(01):01.多线程.c+02.多线程操作.c 内容概要:多线程 ///01.多线程.c #include <stdio.h> #include <stdlib.h> ...

  3. 20160208.CCPP体系详解(0018天)

    程序片段(01):main.c 内容概要:PointWithOutInit #include <stdio.h> #include <stdlib.h> //01.野指针详解: ...

  4. 20160206.CCPP体系详解(0016天)

    代码片段(01):.指针.c+02.间接赋值.c 内容概要:内存 ///01.指针 #include <stdio.h> #include <stdlib.h> //01.取地 ...

  5. 20160205.CCPP体系详解(0015天)

    程序片段(01):01.杨辉三角.c 内容概要:杨辉三角 #include <stdio.h> #include <stdlib.h> #define N 10 //01.杨辉 ...

  6. 20160204.CCPP体系详解(0014天)

    程序片段(01):define.h+data.h&data.c+control.h&control.c+view.h&view.c+AI.h&AI.c+main.c 内 ...

  7. 20160203.CCPP体系详解(0013天)

    程序片段(01):数组.c+02.数组初始化语法.c 内容概要:数组 ///01.数组.c #include <stdio.h> #include <stdlib.h> //0 ...

  8. 20160128.CCPP体系详解(0007天)

    以下内容有所摘取,进行了某些整理和补充 论浮点数的存储原理:float浮点数与double浮点数的二进制存储原理–>阶码 浮点数转二进制 1.整数int类型和浮点数float类型都是占用4个字节 ...

  9. 20160127.CCPP体系详解(0006天)

    程序片段(01):msg.c 内容概要:线程概念 #include <stdio.h> #include <stdlib.h> #include <Windows.h&g ...

随机推荐

  1. POJ 3484

    Showstopper Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1060   Accepted: 303 Descri ...

  2. css display visibility

    当visibility被设置为"hidden"的时候,元素虽然被隐藏了,但它仍然占据它原来所在的位置.注意,当元素被隐藏之后,就不能再接收到其它事件了. display属性就有一点 ...

  3. LINUX进程控制

    1. 引言 一个程序是存储在文件中的机器指令序列.一般它是由编译器将源代码编译成二进制格式的代码.运行一个程序意味着将这个机器指令序列载入内存然后让处理器(cpu)逐条执行这些指令. 在Unix术语中 ...

  4. 如何在jmeter中调用自己写的java工具包

    本文介绍在jmeter中调用自己写java工具包,并非直接继承jmeter提供的java sample request接口. 工具/原料 jmeter eclipse 方法/步骤 通常用jmeter做 ...

  5. zend studio10破解

    http://blog.csdn.net/qq1355541448/article/details/16807429

  6. hdu 3853 LOOPS(基础DP求期望)

    题目大意 有一个人被困在一个 R*C(2<=R,C<=1000) 的迷宫中,起初他在 (1,1) 这个点,迷宫的出口是 (R,C).在迷宫的每一个格子中,他能花费 2 个魔法值开启传送通道 ...

  7. 用httpPost对JSON发送和接收的例子

    HTTPPost发送JSON: private static final String APPLICATION_JSON = "application/json";         ...

  8. 纯CSS实现的右侧底部简洁悬浮效果

    我们见过很多页面右侧浮动效果,最早有QQ联系面板,对联广告等,大多数都是基于Javascript实现的动态效果,今天我给大家分享一个只需要CSS结合DIV实现的右侧浮动效果. HTML 我们希望悬浮效 ...

  9. android中使用html作布局文件

    在android开发中,通常使用xml格式来描述布局文件.就目前而言,熟悉android布局及美化的人员少之又少,出现了严重的断层.大部分企业,其实还是程序员自己动手布局.这样既浪费时间和精力,也未必 ...

  10. QT visual stuido 集成插件不能打开ui文件的解决方法(去掉xml的UTF8标记)

    QT visual stuido 集成插件不能打开ui文件的解决方法 visual studio里不能打开这个ui文件,出现warning等解决方法是:于是将<?xml version=&quo ...