杭电oj平台上的11页题目代码:hdu-page11 (2000~2009)

//2000
//思路:两两字符比较大小
/*#include<stdio.h>
int main()
{
char a, b, c;
char t;
while (~scanf("%c%c%c",&a,&b,&c))
{
getchar();//吃掉空格或者 ,getchar是读入函数的一种。它从标准输入里读取下一个字符,相当于getc(stdin)。返回类型为int型,为用户输入的ASCII码,出错返回-1。
if (a > b)
{
t = a;
a = b;
b = t;
}
if (a>c)
{
t = a;
a = c;
c = t;
}
if (b>c)
{
t = b;
b = c;
c = t;
}
printf("%c %c %c ", a, b, c);
}
return 0;
}*/


//2001
/*#include<stdio.h>
#include<math.h>
int main()
{
double x1, y1, x2, y2;
double temp;
while (~scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2))
{
temp = (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2);
temp = sqrt(temp);
printf("%.2lf ", temp);
}
return 0;
}*/

//2002
/*#include<stdio.h>
#define PI 3.1415927//要取多几位,不然就wa
#include<math.h>
int main()
{
double r;
double v;
while (~scanf("%lf",&r))
{
v = 4 / 3.0*PI*r*r*r;
printf("%.3lf ", v);
}
return 0;
}*/

//2003
/*#include<stdio.h>
#include<math.h>
int main()
{
double a;
while (~scanf("%lf",&a))
{
if (a>=0)
{
printf("%.2lf ", a);
}
else
{
a = (-a);
printf("%.2lf ", a);
}
}
return 0;
}
*/

//2004
/*#include<stdio.h>
#include<math.h>
int main()
{
int t;
while (~scanf("%d",&t))
{
if (t>=90&&t<=100)
{
printf("A ");
}
else if (t>=80 && t <= 89)
{
printf("B ");
}
else if (t >= 70 && t <= 79)
{
printf("C ");
}
else if (t >= 60 && t <= 69)
{
printf("D ");
}
else if (t >= 0 && t <= 59)
{
printf("E ");
}
else
{
printf("Score is error! ");
}
}
return 0;
}
*/

//2005
/*#include<stdio.h>
#include<math.h>
//第二个月是平时28,闰年29
int month[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main()
{
int y, m, d;
int sum;
int i;
while (~scanf("%d/%d/%d",&y,&m,&d))
{
sum = 0;
for ( i = 1; i < m; i++)
{
sum += month[i];
}
sum += d;
//是闰年且月份大于等于2月的时候
//前面的y的判断条件一定要加(),不然会wa,判断完y才判断m
if ((((y%4==0)&&(y%100!=0))||(y%400==0))&&m>=3)
{
sum += 1;
}
printf("%d ", sum);
}
return 0;
}*/

//2006
/*#include<stdio.h>
#include<math.h>
int main()
{
int n;
int result;
int i;
int a;
while (~scanf("%d",&n))
{
result = 1;
//读进去一个a,就判断处理
for ( i = 0; i < n; i++)
{
scanf("%d", &a);
if (a%2!=0)
{
result *= a;
}
}
printf("%d ", result);
}
return 0;
}*/

//2007
/*#include<stdio.h>
#include<math.h>
int main()
{
int m, n;
int sum1, sum2;
int t;
while (~scanf("%d%d",&m,&n))
{
sum1 = 0;
sum2 = 0;
//wa了,不知道什么原因,看看加上判断m.n大小情况能不能ac,加上果真ac啊
if (m>n)
{
t = m;
m = n;
n = t;
}
for (int i = m; i <= n; i++)
{
if (i%2==0)
{
sum1 = sum1 + i*i;
}
else
{
sum2 = sum2 + i*i*i;
}
}
printf("%d %d ", sum1, sum2);
}
return 0;
}*/

//2008
#include<stdio.h>
#include<math.h>
int main()
{
int n;
double a;
int cnt1, cnt2, cnt3;
while (~scanf("%d",&n))
{
if (n==0)
{
break;
}
cnt1 = 0;
cnt2 = 0;
cnt3 = 0;
while (n--)
{
scanf("%lf", &a);
if (a<0)
{
cnt1++;
}
else if (a>0)
{
cnt3++;
}
else
{
cnt2++;
}
}
printf("%d %d %d ", cnt1, cnt2, cnt3);
}
return 0;
}

//2009
#include<stdio.h>
#include<math.h>
int main()
{
int n, m;
double sum;
double ans;
while (~scanf("%d%d",&n,&m))
{
sum = 0;
ans = n;
for (int i = 1; i <= m ; i++)
{
sum = sum + ans;
ans = sqrt(ans);
}
printf("%.2lf ", sum);
}
return 0;
}

一生有所追!
原文地址:https://www.cnblogs.com/BlueBlue-Sky/p/8552941.html