2000
题目描述:
输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
char a[3];
while(cin>>a)
{
sort(a,a+3);
cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10356973 | 2014-03-21 00:42:44 | Accepted | 2000 | 15MS | 344K | 218 B | G++ | MP131420 |
2001
题目描述:
输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。
#include <stdio.h>
#include <cmath>
int main()
{
double x1,x2,y1,y2;
while(~scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2))
{
printf("%.2lf\n",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10357013 | 2014-03-21 00:50:40 | Accepted | 2001 | 0MS | 244K | 226 B | G++ | MP131420 |
2002
题目描述:
根据输入的半径值,计算球的体积。
#include<iostream>
using namespace std;
int main()
{
double m,n;
while(cin>>n)
{
double pi=3.1415927;
m=(double)4/3*pi*n*n*n;
printf ("%.3lf",m) ;
cout<<endl;
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
7484961 | 2013-01-07 19:56:04 | Accepted | 2002 | 15MS | 336K | 257 B | C++ | MP131420 |
题目描述:
求实数的绝对值。
#include <stdio.h>
#include <math.h>
int main()
{
double a;
while(~scanf("%lf",&a))
{
printf("%.2lf\n",fabs(a));
}
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10357034 | 2014-03-21 00:57:17 | Accepted | 2003 | 15MS | 244K | 151 B | G++ | MP131420 |
题目描述:
输入一个百分制的成绩t,将其转换成对应的等级,具体转换规则如下:90~100为A ; 80~89为B; 70~79为C; 60~69为D; 0~59为E;
#include <iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
if(n<0||n>100) cout<<"Score is error!"<<endl;
else if(n<60)cout<<"E"<<endl;
else if(n<70)cout<<"D"<<endl;
else if(n<80)cout<<"C"<<endl;
else if(n<90)cout<<"B"<<endl;
else cout<<"A"<<endl;
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10357924 | 2014-03-21 11:43:25 | Accepted | 2004 | 0MS | 364K | 363 B | G++ | MP131420 |
题目描述:
给定一个日期,输出这个日期是该年的第几天。
#include <stdio.h>
int main()
{
int a[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int y,m,d;
while(~scanf("%d/%d/%d",&y,&m,&d))
{
int sum=d;
for(int i=0;i<m;i++)sum+=a[i];
if((y%4==0&&y%100!=0||y%400==0)&&m>2) sum++;
printf("%d\n",sum);
}
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10358023 | 2014-03-21 12:09:05 | Accepted | 2005 | 15MS | 228K | 309 B | G++ | MP131420 |
题目描述:
给你n个整数,求他们中所有奇数的乘积。
#include <iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
int a,sum=1;
for(int i=0;i<n;i++)
{
cin>>a;
if(a%2!=0)sum*=a;
}
cout<<sum<<endl;
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10357940 | 2014-03-21 11:48:09 | Accepted | 2006 | 0MS | 364K | 273 B | G++ | MP131420 |
题目描述:
给定一段连续的整数,求出他们中所有偶数的平方和以及所有奇数的立方和。
#include <stdio.h>
int main()
{
int x , y, temp, sum1, sum2;
while(scanf("%d %d", &x, &y) != EOF)
{
sum1 = 0;
sum2 = 0;
if(x > y)
{
temp = x;
x = y;
y = temp;
}
for(; x <= y; x++)
{
if( x % 2 == 0)
{
sum1 += x * x;
}
else
sum2 += x * x * x;
}
printf("%d %d\n", sum1, sum2);
}
return 0;
}
me | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author | |
7702896 | 2013-03-06 21:01:56 | Accepted | 2007 | 0MS | 220K | 527 B | G++ | MP131420 |
题目描述:
统计给定的n个数中,负数、零和正数的个数。
#include <iostream>
using namespace std;
int main()
{
int n,i;
while(cin>>n)
{
if(n==0)break;
int a=0,b=0,c=0;double x;
for(i=0;i<n;i++)
{
cin>>x;
if(x<0)a++;
else if(x>0)c++;
else b++;
}
cout<<a<<" "<<b<<" "<<c<<endl;
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10358078 | 2014-03-21 12:24:02 | Accepted | 2008 | 0MS | 400K | 373 B | G++ | MP131420 |
题目描述:
数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和。
#include <stdio.h>
#include <math.h>
int main()
{
double n,m;
while(~scanf("%lf%lf",&n,&m))
{
double sum=n;
for(int i=1; i<m; i++)
{
sum+=sqrt(n);
n=sqrt(n);
}
printf("%.2lf\n",sum);
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
10358057 | 2014-03-21 12:18:42 | Accepted | 2009 | 0MS | 244K | 298 B | G++ | MP131420 |