程序片段(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. HDU 1397 Goldbach's Conjecture(二分,查找素数)

    题目意思很简单,就是找n=p1+p2的种类数,具体看题目吧. 次重点是查找一定范围内的素数: 重点是用二分查找,不然会超时!!! #include<stdio.h> #include< ...

  2. (转)排列算法 Permutation Generation

    转自:http://www.cnblogs.com/dragonpig/archive/2010/01/21/1653680.html http://www.notesandreviews.com/p ...

  3. Javascript 偏移量总结

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  4. 深入浅出ES6(十五):子类 Subclassing

    作者 Jason Orendorff  github主页  https://github.com/jorendorff 在之前的文章<深入浅出ES6(十三):类 Class>中,我们一起深 ...

  5. .htaccess的基本作用及相关语法介绍

    .htaccess是一个纯文本文件,它里面存放着Apache服务器配置相关的指令. .htaccess主要的作用有:URL重写.自定义错误页面.MIME类型配置以及访问权限控制等.主要体现在伪静态的应 ...

  6. angularJS之$apply()方法

    这几天,根据buddy指定的任务,要分享一点angular JS的东西.对于一个在前端属于纯新手的我来说,Javascript都还是一知半解,要想直接上手angular JS,遇到的阻力还真是不少.不 ...

  7. Java7编程 高级进阶学习笔记--嵌套类

    定义: 在一个类中定义的类叫做嵌套类. 作用: 1.允许对相关类进行逻辑分组 2.增强了代码的封装性 3.使代码具有更强的可读性和维护性 使用方式: package com.cmz.baseTest; ...

  8. 文件格式PDF

    pdf(Portable Document Format的简称,意为“便携式文档格式”),是由Adobe Systems用于与应用程序.操作系统.硬件无关的方式进行文件交换所发展出的文件格式.PDF文 ...

  9. idea自动生成serialVersionUID

    Setting->Plugins 找到一个叫  GenerateSerialVersionUID 的插件 下载安装好,alt+insert就可以看到 默认情况下Intellij IDEA是关闭了 ...

  10. Android开发常用代码片段

    拨打电话 public static void call(Context context, String phoneNumber) { context.startActivity( new Inten ...