博文
stu(3047)(2005-08-30 20:24:00)
摘要:#include <iostream.h>
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void max( int *height, int len ){
int i,j,max[2000],time[2000],max_intercept=0,max_time=0;
for (i=0; i<len; ++i) {max[i]=1;time[i]=0;}
for (i=1; i<len; ++i)
for (j=0; j<i; ++j)
if (height[i]<=height[j] && max[j]+1>max [i])
max[i]=max[j]+1;
for (i=0; i<len; ++i)
if (max[i]>max_......
stu(3046)(2005-08-30 20:24:00)
摘要:#include <iostream.h>
#include <math.h>
int main()
{
long n,k,m;
float r;
while(cin>>n)
{
r=float(sqrt(1+8.0*n)-1)/2;
if (fabs(r-int(r))<1e-5)
k=int(r);
else
k=int(r)+1;
m=n-k*(k-1)/2;
if(k%2!=0)
cout<<k+1-m<<'/'<<m<<endl;
else
&nbs......
stu(3038)(2005-08-30 20:23:00)
摘要:#include <iostream.h>
int count;
int loop(int n)
{
for(int i=n/2; i>=1;i--)
{
count++;
loop(i);
}
return count+1;
}
int main()
{
int n;
while(cin>>n)
{
count = 0;
if(n<=1000)
cout<<loop(n)<<endl;
}
return 0;
}
......
stu(3011)(2005-08-30 20:23:00)
摘要:#include "iostream.h"
int main (){
int a,b,count=0,bad=0,sum=0;
while(cin>>a>>b){
count++;
if(a+b>sum&&a+b>8){
sum=a+b;
bad=count;
}
if(count==7){
cout<<bad<<endl;
count=0;
bad=0;
sum=0;
&......
stu(3002)(2005-08-30 20:22:00)
摘要:#include<iostream.h>
#include<stdlib.h>
int main()
{
int n;
char f,q,l;
while(cin>>n) //题目没有给出结束条件
{
if(n>1000000 || n<=0) //辨断n的界线
exit(0);
char ar[26]={'a',}; //初始化,无确定的值的变量为0
//输入和赋值
for(int i=0;i<n;i++)
{
cin>>f>>q>>l;
if(ar[l-97]) ar[f-97]=f;
stu(2147)(2005-08-30 20:21:00)
摘要:#include <iostream.h>
#include <string.h>
int fun(char s)
{
if (s=='V') return 0;
if (s=='U') return 1;
if (s=='C') return 2;
if (s=='D') return 3;
}
int main()
{
char a[4];
a[0]='V';a[1]='U';a[2]='C';a[3]='D';
char str1[9],str2[9],str3[9];
char op;
int i,j,n,k,first=0;
cin>>n;
for (k=0;k<n;k++)
{
cin>>str1>>str2;
first++;
int len=strlen(str1);
for (i=0;i<len;i++)
str1[7-i]=str1[len-i-1];
for (i=0;i<8-len;......
stu(1191)续(2005-08-30 20:21:00)
摘要:int main(void) {
char a, b, c, d;
int n, i;
char s[5];
scanf( "%d", &n);
for (i=0; i<n; ++i) {
scanf( "%s", s);
test( s[0], s[1], s[2], s[3]);
}
return 0;
}
void convert( char c, int i) {
switch (c) {
case 'A':
cardsnum[i] = 1;
break;
case '2':
cardsnum[i] = 2;
break;
case '3':
&nbs......
stu(1191)(2005-08-30 20:20:00)
摘要:#include <stdio.h>
#include <math.h>
#define TheBigNumber 9999999 //出错信息
#define Epslon 0.0000000001
typedef double (*pfddd)( double, double);
double add( double, double);
double sub( double, double);
double mult( double, double);
double div( double, double);
void convert( char, int);
int cardsnum[4];
int is24 (double x) { return fabs(x - 24) < Epslon ; }
void test( char a, char b, char c, char d) {
pfddd f[4] = {add, sub, mult, div};
char o[4] = {'+', '-', '*', '/'};
int i, j, k, l, m, n;
convert( a, 0);
convert( b, 1);
convert( c, 2);
convert( d, 3);
for (i = 0; i < 4; ++i)
for (j = 0; j <......
stu(1185)(2005-08-30 20:19:00)
摘要:# include<iostream.h>
int vexNum,arcNum;
long weight[100];
int arcs[100][100];
int dis[100][100];//dis[v][w]表示v到w的最少权值
long result[100][100];
int k;
long sum;
#define maxValue 32767
void init()
{
int i,j;
for(i=0;i<vexNum;i++)
cin>>weight[i];
for(i=0;i<100;i++)
for(j=0;j<100;j++){
if(i==j)
arcs[i][j]=0;
else
arcs[i][j]=maxValue;
}
 ......
stu(1162)(2005-08-30 20:18:00)
摘要:#include <stdio.h>
#include <math.h>
int change(int test); /* 判定函数 测试TEST */
int fun(int num); /* 判断NUM中可以找到最大的2^n 返回n */
int nn(int n); /* 返回2^n的大小 */
void main()
{
int n=0;
scanf("%d",&n);
while(n)
{
change(n);
printf("\n");
scanf("%d",&n);
......