博文
stu(1186)T(2005-08-23 20:28:00)
摘要:#include <stdio.h>
int leapyear( int y) {
if ((y%4==0 || y%100==0) && (y%400!=0))
return 29;
else
return 28;
}
int main( void) {
int month[12] = { 31, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int n, i, y, m, d;
scanf( "%d", &n);
for (i=0; i<n; ++i) {
scanf( "%d-%d-%d", &y, &m, &d);
if (m==11 || m==12)
printf( "%04d-", ++y);
else
printf( "%04d-", y);
printf( "%02d-", m==10 ? 12 : (m+2)%1......
stu(1151)Z(2005-08-23 20:27:00)
摘要:#include <stdio.h>
int p( int x, int y) {
int i;
int z=1;
for (i=0; i<y; ++i)
z *= x;
return z;
}
int main( void) {
int t, n, x;
unsigned long y;
scanf( "%d", &t);
for ( ; t>0; --t) {
scanf( "%d", &n);
if (n == 32) {
y = 4294967295;
printf( "%u\n", y);
} else {
x = p( 2, n) - 1;
printf( "%d\n", x);
......
tongji(1013)(2005-08-23 20:22:00)
摘要:#include <iostream.h>
#include <string.h>
int main()
{
char a[241];
int b[240];
int m,flag;
int i,j;
int first,second;
while(cin>>a>>m)
{
for (i=0;i<strlen(a);i++)
b[i]=0;
for (i=0;i<m;i++)
{
flag=1;
first=0;
while(flag)
{
while(b[first]==1)
first++;
if (first+1==strlen(a))
{
b[first]=1;
break;
}
second=first+1;
while(b[second]==1)
second++;
if (a[first]>a[second])
{
b[first]=1;
flag=0;
}
first++;
}
}
for (i=0;i<strlen(a);i++)
if (b[i]==0)
cout<<a[i];
cout<<endl;
}
}......
stu(3051)(2005-08-23 20:21:00)
摘要:#include <iostream.h>
#include <string.h>
int main()
{
int i,j,n;
char a[151],b[151];
int flag,m;
while(cin>>n)
{
for (i=0;i<150;i++)
a[i]=b[i]='0';
a[150]=b[150]='1';
for (i=2;i<=n;i++)
{
flag=0;
for (j=150;j>=0;j--)
{
m=(a[j]-'0')*i+flag;
flag=m/10;
a[j]=m%10+'0';
}
flag=0;
for (j=150;j>=0;j--)
{
m=a[j]-'0'+b[j]-'0'+flag;
if (m>=10)
{
flag=1;
m=m-10;
}
else
flag=0;
b[j]=m+'0';
}
}
for (i=0;i<=150;i++)
if (b[i]!='0')
{
j=i;
break;
}
for (i=j;i<=150;i++)
cout<<b[i];
cout<<endl;
}
}......
stu(1067)(2005-08-23 20:19:00)
摘要:#include <iostream.h>
#include <string.h>
int main()
{
char a[101],b[101],c[101],d[101];
int i,j;
int m,n,flag;
while(cin>>a>>b)
{
flag=0;
for (i=0;i<101;i++)
c[i]=d[i]='0';
for (i=0;i<strlen(a);i++)
c[100-i]=a[strlen(a)-1-i];
for (i=0;i<strlen(b);i++)
d[100-i]=b[strlen(b)-1-i];
for (i=100;i>=0;i--)
{
if (c[i]>='0' && c[i]<='9')
m=c[i]-'0';
else
m=c[i]-'a'+10;
if (d[i]>='0' && d[i]<='9')
n=d[i]-'0';
else
n=d[i]-'a'+10;
m=m+n+flag;
if (m>=20) {m=m-20;flag=1;}
else flag=0;
if (m>=10)
c[i]=m+'a'-10;
else
c[i]=m+'0';
}
for (i=0;i<101;i++)
if (c[i]!='0')
{
j=i;
break;
}
for (i=j;i<101;i++)
cout<<c[i];
cout<<endl;
}
}......
stu(1147)Z(2005-08-23 18:46:00)
摘要:#include<stdio.h>
int main()
{
char c;
int i;
int t;
for(c=getchar();c!=-1;c=getchar())
{
if(c=='%'){
scanf("%d",&t);
for(i=0;i<t;i++) printf(" ");
}
else if(c=='#'){
scanf("%d",&t);
for(i=0;i<t;i++) printf("\n");
}
......
pku(2000)(2005-08-23 02:10:00)
摘要:#include <stdio.h>
int main()
{
int days;
int i=1;
int pos;
long money;
while(scanf("%d",&days))
{
pos=1;
i=0;
money=0;
if(days==0) return 0;
while(1)
{
if(days>i)
{
money+=pos*pos;
i+=pos;
/* printf("%d-%d-%d-%d ",days,i,money,pos); */
pos=pos+1;
}
else
{
money-=(i-days)*(pos-1);
break;
}
}
......
test(2159)(2005-08-23 01:23:00)
摘要: #include <stdio.h>
#include <string.h>
int main()
{
char a[100],b[100];
int c[26],d[26];
int i,j,k;
int flag=0;
scanf("%s%s",a,b);
for(j=1;j<=25;j++)
{
for(i=0;i<26;i++)
c[i]=d[i]=0;
for(i=0;i<strlen(a);i++)
{
if(a[i]-'A'>=j)
a[i]-=j;
else
a[i]+=26-j ;
/* if(a[i]=='A') */
/* a[i]='Z'; */
/* c[25]++; */
/* else */
/* c[a[i]-'B']++; */
}
for(i=0;i<strlen(a);i++)
d[b[i]-'A']++;
for(i=0;i<26;i++)
{
if(c[i]!=d[i])
{
flag=1;
&......
pku(2196)(2005-08-23 00:40:00)
摘要:#include <stdio.h>
int main()
{
int i;
int a,b,c;
int sum;
for(i=2992;i<10000;i++)
{
a=b=c=0;
sum=i;
a+=sum/1000;
sum=sum%1000;
a+=sum/100;
sum=sum%100;
a+=sum/10;
sum=sum%10;
a+=sum;
sum=i;
b+=sum/1728;
sum=sum%1728;
b+=sum/144;
sum=sum%144;
b+=sum/12;
sum=sum%12;
b+=sum;
sum=i;
c+=sum/4096;
sum=sum%4096;
c+=sum/256;
sum=sum%256;
pku(2136)没有通过(2005-08-23 00:27:00)
摘要:#include<iostream.h>
#include <stdio.h>
#include <string.h>
int b[26];
int main()
{
char a[72];
int i,j;
int max=0,max2;
for(i=0;i<26;i++)
b[i]=0;
for(i=0;i<=4;i++)
{
cin.getline(a,72);
for(j=0;j<strlen(a);i++)
if(a[j]>='A' && a[j]<='Z')
b[a[j]-'A']++;
}
for(i=0;i<26;i++)
if(b[i]>max)
max=b[i];
for(i=0;i<max;i++)
{
for(j=25;j>=0;j++)
if(b[j]>=max-i)
{
max2=j;
break;
}
for(j=0;j<=max2;j++)
{
if(b[j]>=max-i)
printf("*&q......