Add sample codes
This commit is contained in:
parent
4b068a5144
commit
0f8f1abba8
|
@ -0,0 +1,23 @@
|
||||||
|
//http://acm.hdu.edu.cn/showproblem.php?pid=2000
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
void sort_and_output(char * str){
|
||||||
|
for(int i=0;i<3;i++){
|
||||||
|
for(int j=i+1;j<3;j++){
|
||||||
|
if(str[i]>str[j]){
|
||||||
|
char tmp=str[j];
|
||||||
|
str[j]=str[i];
|
||||||
|
str[i]=tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("%c %c %c\n",str[0],str[1],str[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc,char ** argv){
|
||||||
|
char str[3];
|
||||||
|
while(scanf("%s",str)!=EOF){
|
||||||
|
sort_and_output(str);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
//http://acm.hdu.edu.cn/showproblem.php?pid=2001
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
int main(int argc,char ** argv){
|
||||||
|
double x1,y1,x2,y2;
|
||||||
|
while(scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2)!=EOF){
|
||||||
|
printf("%.2f\n",sqrt(pow(x1-x2,2)+pow(y1-y2,2)));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
//http://acm.hdu.edu.cn/showproblem.php?pid=2002
|
||||||
|
#include <cstdio>
|
||||||
|
#define PI 3.1415927
|
||||||
|
|
||||||
|
int main(int argc,char ** argv){
|
||||||
|
double r;
|
||||||
|
while(scanf("%lf",&r)!=EOF){
|
||||||
|
printf("%.3f\n",4.0/3.0*r*r*r*PI);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
//http://acm.hdu.edu.cn/showproblem.php?pid=2003
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
int main(int argc,char ** argv){
|
||||||
|
double x;
|
||||||
|
while(scanf("%lf",&x)!=EOF){
|
||||||
|
printf("%.2f\n",x>0?x:-x);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue