博文

gcc3(2007-04-18 15:24:00)

摘要:#include <iostream.h>
#include <stdio.h> #define M 20 char a[M][M]; int fuback(int k,int n,char u)
{
    int i;
    if(k==0) u='T';
    if(k==1) u='J';         for(i=k;i<n;i++)
            {
                a[k][i]=u;
                a[i][k]=u;
                a[i][n-1]=u;
                a[n-1][i]=u;             }
            if(k==1)u='0';     if(k!=((M+1)/2)){fuback(k+1,n-1,u+1);}......

阅读全文(2044) | 评论:0

gcc2(2007-04-18 15:23:00)

摘要:#include <stdio.h>
/*
 2. A、B、C、D、E五名学生有可能参加计算机竞赛,根据下列条件判断哪些
  人参加了竞赛:    (1)A参加时,B也参加;    (2)B和C只有一个人参加;    (3)C和D或者都参加,或者都不参加;    (4)D和E中至少有一个人参加;    (5)如果E参加,那么A和D也都参加。
*/ int main()
{  int a,b,c,d,e;       /*其中值1为参加,0为不参加*/
 for(a=0;a<=1;a++)
   for(b=0;b<=1;b++)
      for(c=0;c<=1;c++)
        for(d=0;d<=1;d++)
          for(e=0;e<=1;e++)
        if(((b&&!c)||(!b&&c))&&((c&&d)||(!c&&!d))&&(d||e))        /*分别代表条件2~4*/
                 if((a&&b||!a)&&(e&&(a&&d)||!e))/*代表条件1和5,特别注意a,e不一定参......

阅读全文(2006) | 评论:0

gcc1(2007-04-18 15:22:00)

摘要:// gcc1.cpp : Defines the entry point for the console application.
/*
1.  给定等式  A B C D E     其中每个字母代表一个数字,且不同数字对应不
                    D F G     同字母。编程求出这些数字并且打出这个数字的
             +      D F G     算术计算竖式。              ───────                 X Y Z D E
*/ #include "stdafx.h"
#include <iostream>
#include <stdio.h>
int f=5,g=0,a,b,c,d,e,x,y,z=0;
void Search(int n)
{
  for(c=1;c<10;c++)
 {
    if(c==5) continue;
        for(d=1;d<10;d++)
        {
......

阅读全文(1938) | 评论:0