首页 > 其他 > 详细

Openjudge 1.1 输入输出

时间:2019-12-05 20:54:01      阅读:64      评论:0      收藏:0      [点我收藏+]

1.1.3

按每个整数占8个字符的宽度

#include <cstdio>
using namespace std;
int main( ){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    printf("%8d %8d %8d",a,b,c);//%8d
    return 0;
}

知识点:%8d

http://noi.openjudge.cn/ch0101/03/

1.1.4

读入一个单精度浮点数,保留3位小数输出这个浮点数。

#include <cstdio>
using namespace std;
int main( ){
    float a;//(int)
    scanf("%f",&a);
    printf("%.3f",a);
    return 0;
}

http://noi.openjudge.cn/ch0101/04/

1.1.5

双精度浮点数

#include <cstdio>
using namespace std;
int main( ){
    double a;
    scanf("%lf",&a);
    printf("%.12lf",a);
    return 0;
}

http://noi.openjudge.cn/ch0101/05/

1.1.6

字符型 一个字符 标记符是%c 字符串是%s

#include <cstdio>
using namespace std;
int main( ){
    char s;
    int x;
    float y;
    double z;
    scanf("%c%d%f%lf",&s,&x,&y,&z);
    printf("%c %d %.6f %.6lf",s,x,y,z);
    return 0;
}

http://noi.openjudge.cn/ch0101/06/

1.1.7

换行符 \n

include <cstdio>
using namespace std;
int main( ){
    double m;
    scanf("%lf",&m);
    printf( "%f\n",m);
    printf( "%.5f\n",m);
    printf( "%e\n",m);
    printf( "%g\n",m);
    return 0;
}

http://noi.openjudge.cn/ch0101/07/

Openjudge 1.1 输入输出

原文:https://www.cnblogs.com/liuziwen0224/p/11991597.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!