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

内容概要:题目测试

///Test.c

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define r char S; T R; I N, G, s
#define A(P,O) for(P=O; *P; P=U(P))
typedef char T[128], *I, p[2400];
#define memset (I)\
memset
void*P = strcpy; I Q(); typedef const void*f; int u(f P, f O){
return strncmp((I)P, (I)O, 1);
} T g, c = { 127 }; char l, F[6000000]; I U(I P){
r; strncpy(R, P, 2);
s = strchr(
strcpy(P, c), 0)
; strncpy(P, R, 2); return s;
} T q, B, E; I t(I P){
r; qsort(P,
strlen(P), 1, u);
if (s = strstr(P, c))*s = 0; return P;
} T a = { 2 }; void D(){
r;
S = 1; strcpy(R, c); t(F);
for (; memset(E, S, l),
(S = strlen(
strcat(R, c))) < *R; t(s))for (s = B;
N = strstr(F, E); s = F)
* memset(N, *c, l) = S;
} p H = "(*&,.", k; I j(I P){
r = (I)malloc(
strlen(
strcat(P, "\177 ")));
*strstr(P, c) = 0;
return strcpy(s, P);
} int K(f P, f O){ return u(O, P); } void
b(){
qsort(F,
strlen(F), 1, K);
} void n(I P){
r; A(P, P){
if (N = strchr(F, *P)); else{
t(F);
b(); memset(B, l, *F); N = F;
while (*strrchr(B, l) = 0,
*P <= (S = strlen(B))){
*memset(E, S, l)
= *c; strcat(F, E);
} memset(B, 0, S);
} *N = *c;
} D();
} void C(I P, I O){
r; A(P, P)A(s, O){
*strrchr(
memset(
strchr(
memset(
strncpy(k, B, 254), l, *P), 0), l, *s), l) = 0;
*q = strlen(k)
; strcat(F, q);
} D();
} T i = "\13<\f="; void o(I P){
A(P, P){
*strrchr(
memset(B, *c, *P), *c)
= 0; memset(B, 0,
*P = strlen(B));
}
} int V(f P, f O){ return u(*(I*)P, *(I*)O); } void e(I O){
r; strcpy(H, O)
; strcpy(R, c); for (;
0 < strncmp(F, H, 1)
; strcat(R, c))A(s,
H) memset(B, 0,
*s = strlen(
strcat(
memset(B, *c, *s), c))); *k = 0; do{
while
(0 <= strcmp(F, H)){
n(H); b();
*q = strlen(R)
; strcat(k, q);
}
*strrchr(R, *c) = *B; o(H);
} while (*R);
} char d(I P){
if (P = strstr(P, g)){
if ((*g = getchar()) < *i)' ' < *g ? o(g) : d(" ");
}
else P = B; return*P;
} I m(I
P){
qsort(P,
strlen(P), 1, K); return*P == *c ? U(P) : P;
} void J(I P){
r = m(P);
if (P < s) putchar('-')
; memset(B, l, *s); do{
*E = *i;
if (N = strchr(s,
*q = strlen(B)))
t(memset(
memcpy(E, i, l), *c,
strspn(N, q)))
; putchar(*E);
*strrchr(B, *B = l) = 0;
} while
(*B); puts(B)
; free(P);
} I M(){
r = Q(), P, O; while (S = d(".)$")){
N = Q();
G = strcpy(F, B); P = m(s); O = m(N); if (S == ')'){ C(P, O); }
else{
strcpy(F, P); e(O); if (S == '.')G = k; else O = N;
} free(s); G = j(G);
s = strcat(G, P == s == (O == N) ? B : c)
; free(N);
} return s;
} I h(){
r, P, O; for (N = M(); S = d("*,");
N = strcat(s, S ? c : B)){
G = M(); P = m(N); O = m(G); S = O == G == (S == ','); if (P == N == S)
if (strcmp(P, O) < 0)
{
strcpy(F, O); n(P);
}
else{ strcpy(F, P); n(O); S = N < P; }
else{
strcat(
strcpy(F, P), O); D();
}
s = j(F); free(N)
; free(G);
} return N;
} I Q(){
r; if (S = d(","))
if (N = strstr(s = Q(), c))*N = *B;
else strcat(s, c); else if (d("'")){ s = h(); S = d("("); }
else{
strcpy(F, B); while (*q = d(i))
{
strcpy(H, F)
; memset(
strncpy(F, B, l), S = 1,
strcspn(i, q)); C(H, a);
} s = j(F);
} if (!S){
o(strcpy(F, "tzouby!fssps"))
; puts(F);
} return s;
} int main1(int P, I*O)
{
qsort(O, P, sizeof*O, V);
l = 1 < P ? strtol(*O, 0, l) : 10; C(H,
i); strcpy(i, F); d(g); while (!d("\377"))for (J(h()); !d("\377\n"); d(g)); return 0;
}
///NewTest.c
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h > void main123()
{
/*int x, y;
if (x < y)scanf("%d", &x); else scanf("%d", &y);*/
//int i;
//while (!scanf("%d", &i)) //!1
// getchar(); //abcde<回车> ////ch = getchar() //'a'
//char ch;
// //a ,b ,c d, e
//while ((ch = getchar()) == 'e') //e e e
//{
// putchar(ch); // printf(" * ");
//}
//int x = 5, a = 0, b = 0;
//if (x != (a + b)) printf("x=5\n");
//else printf("a=b=0\n");
//r ight ?
//jhiu
//char c;
//c = getchar(); //while ((c = getchar()) != '?')
// putchar(++c); //int a, b, c, d, x;
//a = c = 0;
////b = 1; d = 20;
////if (a)
//// d = d - 10;
////else if (!b) //else if (if else配对)
//// if (!c)x = 15;
//// else x = 25; // switch (a)
// {
// case 2:
// break; // }
//
//int a = 10;
//int b = 20;
//switch (1+a+b)
//{
//case 1:
// break;
//}
//int n[2] = { 0 }, i, j, k = 2;
//for (i = 0; i < k; i++)
//for (j = 0; j < k; j++) n[j] = n[i] + 1; //printf("%d\n", n[k]);//n[2]
//int i = 1, j = 1, k = 2;
//j++ || ((k++) &&(i++));//短路效应 ////1 + 3 * 4;
//
//printf("%d,%d,%d\n", i, j, k);
//int a=10;
//int c = 0;
//switch (a)
//{
//case 2:
// ;
//} /*double sum = 0.0, x;
for (x = 0.0; x < 3.0; x += 0.1)
sum += x,printf("\n%f",x); printf("\n x=%f", x);*/ //int a = 1;
//int b = 10;
//do
//{
// b -= a; //b=9,a=2 //b=6,a=3 //b=2,a=4 // b=-3 a=5
// a++; //} while (b-- < 10);
//printf("a=%d,b=%d", a, b);
//system("pause"); int i, j, k;
for (i = 1; i <= 6; i++)
{
for (j = 1; j <= 20 - 2 * i; j++)
printf(" ");
for (k = 1; k <= i; k++)
printf("%4d", i);
printf("\n");
}
system("pause");
} void main124()
{
char c;
c = getchar();
//switch必须快语
switch (c)
{
case 0:case 1: printf("%d", c - '0'); break;
default:putchar(c);
} } void main125()
{
int a, b; char op; scanf("%d%d", &a, &b); scanf("%c", &op);
switch (op)
{
case '+': printf("%d + %d = %d\n", a, b, a + b); break;
case '-': printf("%d - %d = %d\n", a, b, a - b); break;
default:printf(""); exit(1);
}
} void main126()
{
int n, i = 1; long sum = 0;
printf("输入一个正整数:");
scanf("%d", &n);
while (i < n)
i += 2;
sum += i;
if (n % 2 == 0) n--;
printf("输出1+3+5+…+%d=%1d\n", n, sum); system("pause");
} void main1215()
{
int s, t, a, b;
scanf("%d,%d", &a, &b);
//a=5//b=2
s = 1;
t = 1;
if (a > 0) //作用范围最近的;如果整体的ifelse会嵌套
{
s = s + 1; /* ① */// s=2 if (a > b)
{
t = s + t; /* ② */
}
else if (a == b)
{
t = 5;
}
else
t = 2 * s;
} printf("s=%d,t=%d\n", s, t);
system("pause");
} void main127()
{ int a, b, m, n;
scanf("%d%d,\n", &a, &b);//a=1,b=0
m = 1; n = 1;
if (a > 0)
{
m = m + n; //1>0 m=2,n=1
if (a < b)
n = 2 * m;
else if (a == b)
n = 5;
else
n = m + 1; } printf("m=%d n=%d\n", m, n); //1,2 system("pause");
} void main128()
{ int s, t, a, b;
scanf("%d,%d", &a, &b);//a=5//b=2
s = 1;
t = 1; //if作用范围只有一句大括号
if (a > 0)
s = s + 1; /* ① */ if (a > b)
t = s + t; /* ② */
else if (a == b)
t = 5;
else
t = 2 * s; printf("s=%d,t=%d\n", s, t); system("pause");
}
void main234()
{
int a, b, m, n;
scanf("%d%d,\n", &a, &b);//a=1,b=0
m = 1; n = 1;
if (a > 0)
m = m + n; //1>0 m=2,n=1 //配对就近
if (a < b)
n = 2 * m;
else if (a == b)
n = 5;
else
n = m + 1; printf("m=%d n=%d\n", m, n); //1,2
}

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

内容概要:转化递归

#include <stdio.h>
#include <stdlib.h> //01.编写程序,求a+aa+aaa+...(n个)aaa,其中a是一个数字.例如:3+33+333+3333+33333.
// 1.分析问题步骤:
// (1).复杂问题简单化
// (2).复杂问题规律化
// (3).复杂问题重复化
//
// 2.递归所能解决的问题:
// 重复问题
// 递推关系
// 关系一:
// 1--->3
// 2--->33
// 3--->333
// n--->(n个)3-->((n-1)个)3*10+3
int nAN(int num, int ele)
{
if (1 == num)
return ele;
return nAN(num - 1, ele) * 10 + ele;
} // 关系二:
// 1-->3
// 2-->3+33
// 3-->3+33+333
// n-->n个整数,n个元素组成最大的数
// Sn-->Sn-1+an
int qNH(int num, int ele)
{
if (1 == num)
return ele;
return qNH(num - 1, ele) + nAN(num, ele);
} int main(void)
{
//printf("%d \n", nAN(5, 3)); //printf("%d \n", qNH(4, 1)); system("pause");
} //void digui3(int n, int a, int sum, int an)
//{
// if (n == 0)
// {
// printf("%d\n", sum);
// return;
// }
// else
// {
// an = an * 10;
// an += a;
// sum += an;
// digui3(n - 1, a, sum, an);
// }
//}

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. ==和equals的区别

    == :是判断两个变量或实例是不是指向同一个内存空间equals :是判断两个变量或实例所指向的内存空间的值是不是相同 结论:欲比较栈中数据是否相等,请用= =:欲比较堆中数据是否相等,请用equal ...

  2. HDU 1026 Ignatius and the Princess I (BFS)

    题目链接 题意 : 从(0,0)点走到(N-1,M-1)点,问最少时间. 思路 : BFS..... #include <stdio.h> #include <string.h> ...

  3. Linux zip解压/压缩并指定目录

    方法如下: 压缩并指定目录举例:zip -r /home/kms/kms.zip /home/kms/server/kms 解压并指定目录 举例:unzip /home/kms/kms.zip -d ...

  4. C++语言,统计一篇英文文章中的单词数(用正则表达式实现)

    下面的例子展示了如何在C++11中,利用regex_search()统计一篇英文文章中的单词数: #include <iostream> #include <regex> #i ...

  5. PHP页面跳转几种实现技巧

    PHP被许多程序员用来开发WEB的首选语言.在实际开发中,网站的各项功能都可以通过PHP语言的编写来满足,比如PHP页面跳转这一方法. 探讨PHP变量解析顺序如何获取提交数据 深入解读PHP运行机制 ...

  6. Struts2笔记——ONGL表达式语言

    OGNL是ObjectGraphic Navigation Language(对象图导航语言)的缩写,它是一个开源项目. Struts 2框架使用OGNL作为默认的表达式语言. ----------- ...

  7. 【转】RESTful Web Services初探

    近几年,RESTful Web Services渐渐开始流行,大量用于解决异构系统间的通信问题.很多网站和应用提供的API,都是基于RESTful风格的Web Services,比较著名的包括Twit ...

  8. Drozer安装

    (1)JDK安装 http://www.cnblogs.com/linbc/p/4319509.html http://blog.csdn.net/qq_31988895/article/detail ...

  9. Linux系统文件权限&目录权限

    linux系统一切都是文件,文件和目录的所属与权限--来分别规定所有者.所有组.其余人的读.写.执行权限. 读(read),写(write),执行(excute)简写为(r.w.x),也可以以用(4. ...

  10. Oracle ->> 层级查询语句(hierarchical query)connect by

    Oracle中的Connect By... Start With语句实现了递归查询或者树状查询. Connect By Prior 一方为起始(root)的ID 参考: http://www.360d ...