水题hdoj-2000、hdoj-2002、hdoj-2003、hdoj-2004

来源:互联网 发布:自适应滤波算法与实现 编辑:程序博客网 时间:2024/05/21 14:40
//hdoj-2000#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;char a[5];int main() {while(scanf("%s", a)!=EOF) {sort(a,a+3);for(int i = 0; i < 3; i++) printf(i!=2?"%c ":"%c", a[i]);printf("\n");}return 0; } 


//hdoj-2002#include<stdio.h>#define PI 3.1415927int main() {double x;while(scanf("%lf", &x)!= EOF) {printf("%.3lf\n", (4.0/3*PI*x*x*x));}return 0; }



//hdoj-2003 #include<stdio.h>int main() {double x;while(scanf("%lf", &x)!=EOF) {printf("%.2lf\n", x>0?x:-x); } return 0; } 


//hdoj-2004#include<stdio.h>int main() {int x;while(scanf("%d",&x)!=EOF) {if(x<0 || x>100) printf("Score is error!\n"); else {int t;switch(x/10) {case 10:case 9: t = 0; break;case 8: t = 1; break;case 7: t = 2; break;case 6: t = 3; break;default: t = 4; break;}printf("%c\n", 'A'+t); } } return 0; }


0 0